php生成二维码的几种方式
1.google开放api,代码如下:
$urltoencode=http://gz.altmi.com; generateqrfromgoogle($urltoencode); function generateqrfromgoogle($chl,$widhtheight ='150',$ec_level='l',$margin='0') { $url = urlencode($url); echo ''; }
2.php类库php qr code
地址:http://phpqrcode.sourceforge.net/
下载:http://sourceforge.net/projects/phpqrcode/
用例,代码如下:
# 创建一个二维码文件
qrcode::png('code data text', 'filename.png');
# 生成图片到浏览器
qrcode::png('some othertext 1234');
3.libqrencode
地址:http://fukuchi.org/works/qrencode/index.en.html
4.qrcode perl cgi & php scripts
地址:http://www.swetake.com/qr/qr_cgi.html
四、第2种方法中在二维码中间加上logo,修改phpqrcode.php中的qrimage类里的png方法,代码如下:
永久链接:
转载随意!带上文章地址吧。
