如何使用此QR码库(php qrcode检测器解码器)

如何使用此QR码库(php qrcode检测器解码器),php,qr-code,Php,Qr Code,请一步一步地告诉我,我是php的业余爱好者。 如何使用此代码。 请帮助或指导我使此代码100%工作 require __DIR__ . "/vendor/autoload.php"; $qrcode = new QrReader('path/to_image'); $text = $qrcode->text(); //return decoded text from QR Code` PHP二维码解码器/阅读器 这是一个PHP库,用于检测和解码二维码。 这是第一款也是唯一一款无需扩展的

请一步一步地告诉我,我是php的业余爱好者。

如何使用此代码。
请帮助或指导我使此代码100%工作

require __DIR__ . "/vendor/autoload.php";
$qrcode = new QrReader('path/to_image');
$text = $qrcode->text(); //return decoded text from QR Code`
PHP二维码解码器/阅读器 这是一个PHP库,用于检测和解码二维码。 这是第一款也是唯一一款无需扩展的二维码阅读器。 从中兴图书馆移植

装置 建议通过Composer安装此库

从项目根目录运行以下命令:

$ composer require khanamiryan/qrcode-detector-decoder  
用法
我之所以回答这个问题,是因为它太复杂了,无法发表评论

首先,在寻求帮助之前,您应该真正尝试使用此代码。但让我们看看提议的代码:

<?php
// This line calls the autoload script generated by Composer. This ensures that you can
// just use the library classes without having to manually include their specific files
require __DIR__ . "/vendor/autoload.php";
// This instantiates the QrReader class and points it to the path of a QR code image
$qrcode = new QrReader('path/to_image');
// This calls the text method on the above instance to determine the contents of the qr code
$text = $qrcode->text();

在没有作曲家的情况下,我也很难得到这个工作库。 问题是它在windows上工作,但在linux上不工作,因为文件名和目录的大小写错误等等

然后我发现这个博客有一个很好的解决方案:

在添加Composer支持之前安装版本

也许您使用的共享主机不允许您安装Composer或使用SSH。也许,像我一样,您的服务器工作得很好,您希望尽可能保持它的干净。无论是哪种方式,通过提交检查,我很高兴看到Composer支持是最近添加的,通过下载在添加Composer支持之前的最后一次提交,我能够忘记Composer并在几秒钟内使库正常工作


它现在运行得很好…

到底是什么不起作用?你会犯什么错误?你的实际代码是什么?我不知道这段代码是否有效。但我不知道如何使用这段代码。因为我是一名初级程序员。请告诉我如何使用这段代码。嗨,这个例子真的很简单,所以我不确定它是如何“一步一步”完成的。也许你真正需要的是找到一个关于PHP基本概念的教程,因为如果你不能遵循这个三行的例子,你将很难编写出一个自己的完整程序。是否可以动态读取二维码图像而不是上传?@Akintude Rotimi:不适用于PHP。您必须寻找在客户端脚本中运行的东西。
<?php
// This line calls the autoload script generated by Composer. This ensures that you can
// just use the library classes without having to manually include their specific files
require __DIR__ . "/vendor/autoload.php";
// This instantiates the QrReader class and points it to the path of a QR code image
$qrcode = new QrReader('path/to_image');
// This calls the text method on the above instance to determine the contents of the qr code
$text = $qrcode->text();
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);