php二维码程序的实现代码

WBOY
发布: 2016-07-25 08:58:43
原创
1046 人浏览过
  1. //google api
  2. $url="http://phperzj.sinaapp.com/";
  3. echo cre_QR($url);
  4. function cre_QR($chl,$widhtHeight ='150',$EC_level='L',$margin='0'){
  5. $chl=urlencode($chl);
  6. $qr = '
  7. QR code
  8. ';
    登录后复制
  9. return $qr;
  10. }
  11. ?>
复制代码

参数说明如下: http://chart.apis.google.com/chart? : 调用 Google 图表 API cht=qr :选择生产QR码 &chs=100×100 :尺寸大小 &chld=L|4 :L代表默认纠错水平; 4代表二维码边界空白大小,可自行调节。 &chl= :二维码内容 很贴心的是这个api支持get和post

2.php类库PHP QR Code PHP QR Code is open source (LGPL) library for generating QR Code, 2-dimensional barcode. Based on libqrencode C library, provides API for creating QR Code barcode images (PNG, JPEG thanks to GD2). Implemented purely in PHP, with no external dependencies (except GD2 if needed). 地址:http://phpqrcode.sourceforge.net/ 下载:http://sourceforge.net/projects/phpqrcode/ 说明: To install simply include: qrlib.php for full version (also you have to provide all library files form package plus cache dir) OR phpqrcode.php for merged version (only one file, but slower and less accurate code because disabled cache and quicker masking configured)

Then use it as follows: QRcode::png(‘code data text’, ‘filename.png’); // creates file QRcode::png(‘some othertext 1234′); // creates code image and outputs it directly into browser 例子:

  1. //PHP QR CODE
  2. //include("phpqrcode/qrlib.php");
  3. include("phpqrcode/phpqrcode.php");
  4. QRcode::png("http://phperzj.sinaapp.com");
  5. ?>
复制代码

3.libqrencode

地址:http://fukuchi.org/works/qrencode/index.en.html php支持请参考:http://hirokawa.netflowers.jp/entry/4900/

4.QRcode Perl CGI & PHP scripts 地址:http://www.swetake.com/qr/qr_cgi.html



来源:php.cn
本站声明
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn
最新问题
热门教程
更多>
最新下载
更多>
网站特效
网站源码
网站素材
前端模板
关于我们 免责声明 Sitemap
PHP中文网:公益在线PHP培训,帮助PHP学习者快速成长!