测试环境:
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重启服务
测试图片:
验证代码:
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