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

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

WBOY
Release: 2016-06-06 20:07:37
Original
1138 people have browsed it

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>
Copy after login

$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>
Copy after login

?>

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template