我想创建一个包含网址的QR码。
例如:
Product Details :
Name : XYZ
Price : $43
Url : www.abc.com/rty
Description : Wonderful product
我设法显示这些数据,但不是那种确切的格式。在解码时输出(下面):
Product Details : \n Name : XYZ \n Id : 43 \n Link : www.abc.com/rty \n Description : Wonderful product
请帮忙。
使用Phpqrcode库。
我的代码:
$contents = $producttype.'\n';
$contents .= 'Name : '.$collection->getName().'\n';
$contents .= 'Id : '.$collection->getId().'\n';
$contents .= 'Link :'.Mage::getUrl().$collection->getUrlKey().'\n';
$contents .= 'Description : '.$collection->getShortDescription().'\n';
$imagename = 'qrcode' . md5($collection->getId()) . '.png';
$filename = $PNG_TEMP_DIR.$imagename;
QRcode::png($contents, $filename, $errorCorrectionLevel, $matrixPointSize, 2);
数据变得动态,人们可以很容易地假设。
答案 0 :(得分:1)
PHP_EOL
QRcode::png("http://www.abc.com", "test.png", "L", 4, 4);
但是,如果我只添加上面的代码,那么它会提供 url type qrcode 。
此外,链接部分还取决于用于读取QR码的应用程序。