include_once(env(\'root_path\')."/extend/qrcode/phpqrcode.php");//加载qrcode类
$QRcode = new QRcode();
$url = \'test\'; //二维码内容
$errorCorrectionLevel = \'H\'; //容错级别
$matrixPointSize = 5; //生成图片大小
ob_start();
$QRcode::png($url, false, $errorCorrectionLevel, $matrixPointSize, 1);
$ob_contents = ob_get_contents(); //读取缓存区数据
ob_end_clean();
$myImage = ImageCreate(190,190); //参数为宽度和高度
$qr = imagecreatefromstring($ob_contents);
$qr_size = imagesx($qr);
$img_x_y = (190-$qr_size)/2; //245为宽度
$white = ImageColorAllocate($myImage, 255, 255, 255);
$green=ImageColorAllocate($myImage, 208, 195, 224);
$font_path = env(\'root_path\').\'/public/font/CGOmegaBoldItalic.ttf\'; //引入字体
imagettftext($myImage, 5, 0, 150, 178, $green, $font_path, \'12454\');
imagecopyresampled($myImage, $qr, $img_x_y, $img_x_y, 0, 0, $qr_size, $qr_size, $qr_size, $qr_size); //重新组合图片并调整大小
Header("Content-type: image/png");
imagepng($myImage , \'qr_txt.png\'); //带文字二维码的文件名