use Zxing\Common\HybridBinarizer;
use Zxing\Qrcode\QRCodeReader;
include_once(‘common/customFunctions.php’);
final class QrReader
{
}
QrReader.php完整代码:
<?php namespace Zxing; use Zxing\Common\HybridBinarizer; use Zxing\Qrcode\QRCodeReader; include_once('common/customFunctions.php'); final class QrReader { const SOURCE_TYPE_FILE = 'file'; const SOURCE_TYPE_BLOB = 'blob'; const SOURCE_TYPE_RESOURCE = 'resource'; private $bitmap; private $reader; private $result; public function __construct($imgSource, $sourceType = QrReader::SOURCE_TYPE_FILE, $useImagickIfAvailable = true) { if (!in_array($sourceType, [ self::SOURCE_TYPE_FILE, self::SOURCE_TYPE_BLOB, self::SOURCE_TYPE_RESOURCE, ], true)) { throw new \InvalidArgumentException('Invalid image source.'); } $im = null; switch ($sourceType) { case QrReader::SOURCE_TYPE_FILE: if ($