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());//生成指定的二维码
h5 调起小程序,是需要调用微信开放接口,生成签名,和分享逻辑一样
// 这里是给开放性标签准备的,第一种方式暂时用不到
wx.config({
debug: true, // 调试时可开启
appId: '替换的位置',
timestamp: 0, // 必填,填任意数字即可
nonceStr: 'nonceStr', // 必填,填任意非空字符串即可
signature: 'signature', // 必填,服务端生成的,不能任意
jsApiList: ['chooseImage'], // 安卓上必填一个,
openTagList:['wx-open-launch-weapp'], // 填入打开小程序的开放标签名
})