$path = ROOT_PATH; //tp项目根路径
require_once $path.'vendor/phpqrcode/phpqrcode.php'; //加载phpqrcode库
$url = 'http://'.$_SERVER['HTTP_HOST'].'/home/index/detail?id='.$param['id'];
$value = $url; //二维码内容
$errorCorrectionLevel = 'L'; //容错级别
$matrixPointSize = 26; //生成图片大小
$filename = 'qrcode/'.microtime().'.png';
QRcode::png($value,$filename , $errorCorrectionLevel, $matrixPointSize, 2);
下载官网地址
PHP QR Code - QR code generator, an LGPL PHP library