if (!function_exists('createQRCode')) { function createQRCode($url = '', $filename) { require_once('../vendor/phpqrcode/phpqrcode.php'); $filename = $filename . '.png'; $codeDir = date("Y-m-d", time()); $path = CODE_FILE_DIR . $codeDir; if (!file_exists($path)) { mkdir($path,0777,true); } $filePath = $path . '/' . $filename; $value = $url; //二维码内容 $errorCorrectionLevel = 'H'; //容错级别 $matrixPointSize = 30; //生成图片大小 //生成二维码图片 \QRcode::png($value, $filePath, $errorCorrectionLevel, $matrixPointSize, 5); $pngPath = $codeDir . '/' . $filename; return $pngPath; } }
createQRCode($info['pay_url'], $orderData['orderId'] . time());//生成指定的二维码