Linux Ubuntu中的PHP QR Code类错误


PHP QR Code Class error in Linux Ubuntu

PHP QR Code在执行最基本的QR Code生成示例时也会出现以下错误。

"致命错误:找不到类'QRcode'"。

我已经将整个PHP二维码文件夹复制到我的var/www目录中,但仍然没有解决方案。

样品

 <?php
include('phpqrcode/qrlib.php');
QRcode::png('PHP QR Code :)');
?>
//give the full path if you have linux
include('/var/www/phpqrcode/qrlib.php');
//or windows wamp or xampp
include('c://wamp/phpqrcode/qrlib.php');
//check the class is exist or not
if(class_exists('QRcode'))
{
    QRcode::png('PHP QR Code :)');
}else{
    echo 'class is not loaded properly';
}

这在我的本地Ubuntu机器上运行良好(在安装phpqrcode之后)。

include('/usr/share/phpqrcode/qrlib.php');

如果你想把所有东西都放在你的网络文件夹里,只需把文件夹里的所有东西都复制到你的网络根目录中(尽管最好把它放在网络根目录之外)

在将目录的权限更改为0777之前,我也遇到了同样的问题。现在对我来说一切都很好。