PHPJavaScript 二维码解码器, 识别二维码
Posted supramolecular
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了PHPJavaScript 二维码解码器, 识别二维码相关的知识,希望对你有一定的参考价值。
javascript 二维码解码器
代码下载链接:https://download.csdn.net/download/supramolecular/15901268
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
</head>
<script src="js/jquery.js"></script>
<script src="js/reqrcode.js"></script>
<script src="js/qrcode.js"></script>
<body>
<input type="file" name="file" id="fileUpload">
<img src="" alt="" id="newqrcode">
<div class="wx-qr-box" id="qrcode" class="qrcode"></div>
</body>
<script>
$().ready(function ()
var getObjectURL = function (file)
var url = null;
if (window.createObjectURL != undefined) // basic
url = window.createObjectURL(file);
else if (window.URL != undefined) // mozilla(firefox)
url = window.URL.createObjectURL(file);
else if (window.webkitURL != undefined) // webkit or chrome
url = window.webkitURL.createObjectURL(file);
return url;
;
$("#fileUpload").change(function ()
console.log($("#fileUpload")[0].files);
console.log(getObjectURL($("#fileUpload")[0].files[0]));
qrcode.decode(getObjectURL($("#fileUpload")[0].files[0]));
qrcode.callback = function (imgMsg)
var qrcode = new QRCode(document.getElementById("qrcode"),
text: imgMsg,
width: 128,
height: 128,
colorDark : "#409EFF",
colorLight : "#ffffff",
correctLevel : QRCode.CorrectLevel.H
);
);
);
</script>
</html>
PHP 二维码解码器
安装依赖
composer require khanamiryan/qrcode-detector-decoder
示例代码
use \\QrReader;
class TestService extends BaseService
private function _getText()
$qrcode = new QrReader('图片路径');
$text = $qrcode->text(); //return decoded text from QR Code
return $text;
以上是关于PHPJavaScript 二维码解码器, 识别二维码的主要内容,如果未能解决你的问题,请参考以下文章