用户推广二维码链接传给后台生成带背景图片的二维码
public function getPromote()
{
//生成推广二维码
$qrcode_path = './Public/attached/code/code'.'_'.$this->user['id'].'.png';
$content = C('SITE_URL').'/qrcoderegister?refer='.$this->user['int_code'];
if(!is_file($qrcode_path)){
$matrixPointSize = 10;
$matrixMarginSize = 1;
$errorCorrectionLevel = 'M';
makecode_no_pic($content,$qrcode_path,$matrixPointSize,$matrixMarginSize,$errorCorrectionLevel);
}
$this->res['data']['qrcode'] = C('URL').'/Public/attached/code/code'.'_'.$this->user['id'].'.png';
$this->res['data']['int_code'] = $this->user['int_code'];
$this->res['data']['url'] = $content;
$this->response($this->res,'json');
}
makecode_no_pic方法:
function makecode_no_pic($content,$qrcode_path_new,$matrixPointSize,$matrixMarginSize,$errorCorrectionLevel){
ob_clean ();
Vendor('phpqrcode.phpqrcode');
$object = new \QRcode();
$object::png($content,$qrcode_path_new, $errorCorrectionLevel, $matrixPointSize, $matrixMarginSize);
}
原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。
如有侵权,请联系 cloudcommunity@tencent.com 删除。
原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。
如有侵权,请联系 cloudcommunity@tencent.com 删除。