简体   繁体   English

使用 phpqrcode 生成 SVG 时出错

[英]Error generating SVG with phpqrcode

I am trying to execute following code from theSVG basic output example from the docs.我正在尝试从文档的SVG 基本输出示例中执行以下代码。

<?php
include('vendors/phpqrcode/qrlib.php');
$svgCode = QRcode::svg('PHP QR Code :)');
echo $svgCode; 

All I get is the error:我得到的只是错误:

Fatal error: Call to undefined method QRcode::svg()致命错误:调用未定义的方法 QRcode::svg()

/path/to/php/file/index.php on line 1337 /path/to/php/file/index.php 第 1337 行

The strange thing is that the simple PNG output example works fine without any errors, so the include must be correct.奇怪的是,简单的 PNG 输出示例工作正常,没有任何错误,因此包含必须正确。

<?php
include('vendors/phpqrcode/qrlib.php');
QRcode::png('PHP QR Code :)');

Do you guys have an idea what I might have forgot to check?你们知道我可能忘了检查什么吗? Maybe the error is obvious for you.也许这个错误对你来说很明显。

As noticed in another thread and I experienced myself, the latest version is at https://github.com/t0k4rt/phpqrcode .正如在另一个线程中注意到的那样,我亲身体验过,最新版本位于https://github.com/t0k4rt/phpqrcode With the version there, SVG is implemented and working.有了那里的版本,SVG 就被实现并工作了。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM