引入phpqrcode文件,调用QRcode::png方法生成二维码
function scerweima($url=''){
require_once('../cmobile/control/qrcode/phpqrcode/phpqrcode.php');
$value = $url; //二维码内容
$errorCorrectionLevel = 'L'; //容错级别
$matrixPointSize = 5; //生成图片大小
//生成二维码图片
$filename = BASE_UPLOAD_PATH.DS.'qrcode'.DS.microtime().'.png';
QRcode::png($value,$filename , $errorCorrectionLevel, $matrixPointSize, 2);
$QR = $filename; //已经生成的原始二维码图片文件
$QR = imagecreatefromstring(file_get_contents($QR));
//输出图片
$file = time().'qrcode.png';
imagepng($QR, $file);
imagedestroy($QR);
return c('main_url_main')."/bmobile/".$file;
}