Home  >  Article  >  php教程  >  Thinkphp3.2+PHPQRCode 二维码生成示例

Thinkphp3.2+PHPQRCode 二维码生成示例

WBOY
WBOYOriginal
2016-06-07 11:37:521743browse

完美解决Class 'Home\Controller\QRcode' not found 问题
Thinkphp3.2+PHPQRCode二维码生成
1、下载PHPQRCode解压后台把phpqrcode.php存放至ThinkPHP/Extend/Vendor/文件夹中
2、在控制器中IndexController创建一个生成二维码的方法qrcode public function qrcode($url='http://www.jihexian.com/',$level=3,$size=4){<br>   Vendor('phpqrcode.phpqrcode');<br>   $errorCorrectionLevel =intval($level) ;//容错级别 <br>   $matrixPointSize = intval($size);//生成图片大小 <br> //生成二维码图片 <br>   //echo $_SERVER['REQUEST_URI'];<br>   $object = new \QRcode();<br>   $object->png($url, false, $errorCorrectionLevel, $matrixPointSize, 2);   <br> <br>  }3、在浏览器中访问http://127.0.0.1/你的项目名/index.php?s=/home/index/qrcode
4、生成效果
Thinkphp3.2+PHPQRCode 二维码生成示例
http://demo.jihexian.com/Index/qrcode.html

附件 phpqrcode.zip ( 27.49 KB 下载:825 次 )

AD:真正免费,域名+虚机+企业邮箱=0元

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn