Home  >  Article  >  Backend Development  >  html5 - phpqrcode QR里面代码怎么写才能生成{"src":"qrcode_2_2016.png"} 这样的?

html5 - phpqrcode QR里面代码怎么写才能生成{"src":"qrcode_2_2016.png"} 这样的?

WBOY
WBOYOriginal
2016-06-06 20:07:371059browse

phpqrcode QR里面代码怎么写才能生成{"src":"qrcode_2_20160525112634.png"} 这样的?
参考页面http://fdjcom.com/QR.php 知道的大神回答下,万分谢谢!

回复内容:

phpqrcode QR里面代码怎么写才能生成{"src":"qrcode_2_20160525112634.png"} 这样的?
参考页面http://fdjcom.com/QR.php 知道的大神回答下,万分谢谢!

这不就是个json吗? php的系统函数 json_encode() 可以把数组转化成json

具体怎么写呢?我现在的QR.php生成的是二维码图片,代码如下:

<code>include "phpqrcode/phpqrcode.php"; </code>

$url = 'http://wx.weiaitang.com/'.$_SERVER['HTTP_HOST'].$_SERVER['PHP_SELF'].'?'.$_SERVER['QUERY_STRING'];
$burl = strstr( $url,'qr.php');
$qurl = strstr( strstr( $url, '?url='), 'http');
if ($burl !== "qr.php?" and strpos($burl,'?url=http://') !== false) {
$value=$qurl;
}
else {
$value = "http://wx.weiaitang.com/";
}

<code>$errorCorrectionLevel = "L"; 
$matrixPointSize = "8"; 
$margin="1";
QRcode::png($value, false, $errorCorrectionLevel, $matrixPointSize,$margin); 
echo $burl;
exit; </code>

?>

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn