PHP(tp5)解析二维码

切到项目跟目录执行(镜像好像是国外的,可能需要翻·墙):

composer require khanamiryan/qrcode-detector-decoder

然后项目中使用:

$img = $this->request->param("img/s", '');
empty($img) && $this->error(__('请上传二维码'));

$qrcode = new xingQrReader(ROOT_PATH . '/public' . $img);   //绝对路径
$imgText = $qrcode->text(); //返回二维码的内容

 

大功告成!!!

原文地址:https://www.cnblogs.com/j-jian/p/15412343.html