关于在thinkcmf中使用phpqrcode生成二维码


首先:下载二维码的类库   phpqrcode文件
 

然后将下载好的文件放到/simplewind/Core/Library/Vendor下

public function scerweima(){


$url=www.baidu.com ;//将url地址写好

 Vendor('phpqrcode.phpqrcode');//加载类库
 
 
$errorCorrectionLevel = 'L'; //容错级别
$i=320;
$j = floor($i/37*100)/100 + 0.01;
$matrixPointSize = $j; //生成图片大小

 

 
//生成二维码图片
        $filename = SITE_PATH.'public/erweima/'.time().rand(100,999).'.png';//生成二维码的图片名称,以及保存地址
        $QRcode=new \QRcode();//实例化对象

 

$QRcode::png($url,$filename , $errorCorrectionLevel, $matrixPointSize, 2);
 
$QR = $filename; //已经生成的原始二维码图片文件

 

$QR = imagecreatefromstring(file_get_contents($QR));
 
 
return $filename;
}


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM