php生成二维码之CI实战

来源:互联网 发布:g76m16f1.0内螺纹编程 编辑:程序博客网 时间:2024/06/07 04:53
引入PHP文件
phpqrcode.php
直接使用
<?php
include 'phpqrcode.php'; 
$value = 'http://www.jb51.net'; //二维码内容 
$errorCorrectionLevel = 'L';//容错级别 
$matrixPointSize = 6;//生成图片大小 
$path='/Users/langzi/code/';//图片位置
$name='club.png';//图片名
$file=$path.$name;
//生成二维码图片 
QRcode::png($value,$file, $errorCorrectionLevel, $matrixPointSize, 2); 
$show='http://localhost/';
echo "<img src=".$show.$name.">";
?>

 在CI中使用方法加入helper文件夹修改文件名为
phpqrcode_helper.php
然后使用$this->load->helper(phpqrcode);
便可直接使用
QRcode::png($value,$file, $errorCorrectionLevel, $matrixPointSize, 2); 
方法生成图片。
0 0
原创粉丝点击