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

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

WBOY
WBOYasal
2016-06-06 20:07:371061semak imbas

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>

?>

Kenyataan:
Kandungan artikel ini disumbangkan secara sukarela oleh netizen, dan hak cipta adalah milik pengarang asal. Laman web ini tidak memikul tanggungjawab undang-undang yang sepadan. Jika anda menemui sebarang kandungan yang disyaki plagiarisme atau pelanggaran, sila hubungi admin@php.cn