您的位置:首页 > 编程语言 > PHP开发

TP5 二维码解码实现(php二维码识别)window系统

2017-07-29 09:25 579 查看
测试环境:

win10 64位 wamp3.0.4 php5.6.19

准备工作:

安装 ImageMagick-7.0.6-3-Q16-x64-dll.exe,zbar-0.10-setup.exe

配置 ZbarCode.dll (附件给出)

解压后将对应的版本 php_zbarcode.dll 复制到 PHP ext 目录下

如果是64位PHP 将 libzbar64-0.dll libiconv.dll 复制到PHP路径下

如果是32位PHP 将 libzbar-0.dll libiconv-2.dll 复制到PHP路径下

在 php.ini 中设置 extension=php_zbarcode.dll wamp重启服务

测试图片:



验证代码:
//二维码解析
public function qrDecode($imagePath = '')
{
$imagePath = ROOT_PATH . '/public/qrcode/hbh/3.png';

debug('begin');

$image         = new \ZbarCodeImage($imagePath);
$scanner       = new \ZbarCodeScanner();
$qrCodeContent = $scanner->scan($image);

debug('end');
echo debug('begin', 'end', 6) . 's;' . debug('begin', 'end', 'm');
dump($qrCodeContent);
}


结果:



当然也可以识别条形码

类库下载地址:http://download.csdn.net/detail/mistruster/9542961
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息