PHP 生成二维码
Posted z329982468
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了PHP 生成二维码相关的知识,希望对你有一定的参考价值。
include "./phpqrcode/phpqrcode.php";
//定义纠错级别
$errorLevel = "L";
//定义生成图片宽度和高度;默认为3
$size = "4";
//生成网址类型
$unique_url = $_REQUEST['unique_url'];
$urlID = isset($_REQUEST['urlID'])?$_REQUEST['urlID']:'';
$srcopenid = $_REQUEST['srcopenid'];
$base64_urlID = $_REQUEST['base64_urlID'];
$url = $unique_url.'?urlID='.$base64_urlID.'&srcopenid='.$srcopenid;
// $img = QRcode::png($url, false, $errorLevel, $size);
// QRcode::png($unique_url,false, $errorLevel, $size, 2);
$img_name = "./code_img/$urlID.png";
if(QRcode::png($url,$img_name, $errorLevel, $size, 2))
echo 111111;
else
echo 22222;
// 生成二维码
$unique_url = "http://giftcard.anchor.cn/anchor_card/home/customer/gift-cards.php";
$quest_url = "http://giftcard.anchor.cn/anchor_card/home/two_dimension_code.php?unique_url=$unique_url&urlID=$urlID&base64_urlID=$base64_urlID&srcopenid=$openid";
// $quest_url = "http://giftcard.anchor.cn/anchor_card/home/test.php?uid=".$urlID;
// $a = file_get_contents($quest_url);
$templateMsg = array();
$templateMsg['unique_url'] = "'$unique_url'";
$templateMsg['urlID'] = "'$urlID'";
$templateMsg['base64_urlID'] = "'$base64_urlID'";
$postContent = json_encode($templateMsg);
$sendInfo = postData($postContent, $quest_url);
以上是关于PHP 生成二维码的主要内容,如果未能解决你的问题,请参考以下文章