Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/url/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
使用phpqrcode库添加url_Php_Url_Qr Code - Fatal编程技术网

使用phpqrcode库添加url

使用phpqrcode库添加url,php,url,qr-code,Php,Url,Qr Code,我想创建一个二维码,将有网址。 例如: 我设法显示了这些数据,但不是以那种精确的格式。解码时的矿山(如下)输出: Product Details : \n Name : XYZ \n Id : 43 \n Link : www.abc.com/rty \n Description : Wonderful product 请帮忙。 使用了Phpqrcode库 我的代码: $contents = $producttype.'\n'; $contents

我想创建一个二维码,将有网址。
例如:

我设法显示了这些数据,但不是以那种精确的格式。解码时的矿山(如下)输出:

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);
数据是动态的,我们可以很容易地假设。

好的。我已经做到了。
对于第二行的数据,使用
PHP\u EOL

QRcode::png("http://www.abc.com", "test.png", "L", 4, 4);
但是,如果我只添加上面的代码,那么它将给出url类型qrcode
此外,链接部分还取决于用于读取二维码的应用程序。

确定。我已经做到了。
对于第二行的数据,使用
PHP\u EOL

QRcode::png("http://www.abc.com", "test.png", "L", 4, 4);
但是,如果我只添加上面的代码,那么它将给出url类型qrcode

此外,链接部分还取决于用于读取二维码的应用程序。

当您回显此输出时,请尝试先回显“”\n表示新行,但需要渲染。请提供一些不起作用的代码,它太不清楚您要完成什么。@KHMKShore:已更新它。当您回送此输出时,请先回送“”\n表示新行,但需要渲染。请提供一些不起作用的代码,它太不清楚您要实现什么。@KHMKShore:已更新它。