如何在 PHP 中读取二维码?

发布于 2024-09-26 19:37:43 字数 224 浏览 3 评论 0原文

有没有简单的 PHP 实现来解码 QR 码?

我有一个假智能手机。其中一部手机标榜为智能手机,但我无法下载任何应用程序,我想创建一个电子邮件服务,在那里我可以拍摄二维码照片,将其彩信发送到此电子邮件,然后电子邮件返回二维码包含什么内容。

然而,我能找到的唯一库是 Python(可能还有 C++)的库,在我有限的托管环境中我都无法访问这两个库。

有没有只使用 PHP 读取二维码的方法?

Is there a plain PHP implementation for decoding QR codes?

I have a faux-smartphone. One of those phones that parades as a smartphone but that I can't download any apps for, and I want to create an email service to where I can take a picture of a QR code, MMS it to this email, and the email returns what the QR code contains.

However, the only libraries I've been able to find are in Python (and probably C++), neither of which I can access on my limited hosting environment.

Is there a way to read QR codes using only PHP?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

葬﹪忆之殇 2024-10-03 19:37:43

只有一款纯PHP二维码解码器。它与 GD 库一起使用,但也可以使用 ImageMagick。这个PHP二维码阅读器是从ZXing移植的。

There is only one pure PHP QR code decoder. It's working with GD library, but can use also ImageMagick. This PHP QR code reader is ported from ZXing.

https://github.com/khanamiryan/php-qrcode-detector-decoder

回忆那么伤 2024-10-03 19:37:43

我不知道有任何纯 php 解码器。像这样解码图像需要大量的处理器资源,并且用纯解释性语言来完成它是具有挑战性的。

zxing (http://code.google.com/p/zxing/) 提供解码器Java 和 C++ 中的实现。理论上,应该可以将 C++ 库链接为 php 扩展,尽管我对此机制一无所知。我已经为 Ruby 完成了...

此外,zxing 确实有一个在线解码器,位于 http://zxing。 org/w/decode.jspx。我的想法是,您可以从 PHP 获取图像并将其发布到 Web 服务并检索解码的数据。我不知道从 PHP 进行远程 Web 服务调用的机制以及不同的托管环境可能如何限制这一点,但这似乎合理?

I'm not aware of any pure php decoder. Decoding images like this is pretty processor intensive and doing it in a purely interpreted language is challenging.

zxing (http://code.google.com/p/zxing/) provides a decoder implementation in both Java and C++. In theory, it should be possible to link the C++ library as a php extension, though I don't know anything of the mechanics of that. I've done it for Ruby ...

Moreover, zxing does have an online decoder at http://zxing.org/w/decode.jspx. My thinking is that from PHP you can take the image and post it to the webservice and retrieve the decoded data. I don't know the mechanics of making remote web service calls from PHP and how different hosting environments might limit that, though, but it seems reasonable?

很酷不放纵 2024-10-03 19:37:43

如果您可以使用 phpextension,请使用 https://github.com/mkoppanen/php 的 php-zbarcode -zbarcode 可以读取二维码。它是来自 http://zbar.sourceforge.net 的 ZBar 包装器,而 ZBar 又是一个 LGPL C 库解码条形码。

If you have the possibility to use a phpextension, php-zbarcode at https://github.com/mkoppanen/php-zbarcode can read qrcodes. It's a wrapper for ZBar from http://zbar.sourceforge.net, which in turn is a LGPL C library for decoding barcodes.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文