vendor("phpqrcode.phpqrcode");
$url=‘http://www.dc3688.com/mobile/User/qrurl/?userid=‘."$this->user_id";
$level=3;
$size=4;
$errorCorrectionLevel =intval($level) ;//容错级别
$matrixPointSize = intval($size);//生成图片大小
$path = "public/upload/qrcode/";
if(!file_exists($path))
{
mkdir($path, 0700);
}
$username=$this->user_id;
$fileName = $path.$username.‘.png‘;
//生成二维码图片
//echo $_SERVER[‘REQUEST_URI‘];
$object = new \QRcode();
$object->png($url, $fileName, $errorCorrectionLevel, $matrixPointSize, 2);
$result[‘qcode‘]=$fileName;
时间: 2024-09-17 02:34:22