当前位置:网站首页>PHP generates QR code (learning)
PHP generates QR code (learning)
2022-07-28 10:17:00 【Hello, old days】
php The basic way of writing :
<?php
echo "Hello World!";
?>
1 Advantages of QR code :(1) Large information capacity
(2) A wide range of coding
(3) Strong fault tolerance
(4) High reliability of post code
(5) Encryption can be introduced
(6) The cost is low , Easy to make
shortcoming :(1) QR code technology has become a mobile phone virus 、 A new channel for the spread of phishing websites
(2) Information leaks
2. PHP Generate QR Code
First download phpqrcode Class file download , Download address :https://sourceforge.net/projects/phpqrcode/
Then extract the file to the project file , Finally, create a new one in the project file PHP file , Write the following code in the file to generate a QR code .

3.jq Generate qr code
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>qrcode</title>
</head>
<body>
<div id="qrcode">
</div>
<script src="https://cdn.bootcss.com/jquery/3.3.1/jquery.slim.min.js"></script>
<!--<script src="jquery-qrcode/jquery.qrcode.min.js" type="text/javascript"></script>-->
<script src="https://cdn.bootcss.com/jquery.qrcode/1.0/jquery.qrcode.min.js"></script>
<script type="text/javascript">
// Translate Chinese into utf-8
function utf16to8(str) {
var out, i, len, c;
out = "";
len = str.length;
for(i = 0; i < len; i++) {
c = str.charCodeAt(i);
if((c >= 0x0001) && (c <= 0x007F)) {
out += str.charAt(i);
} else if(c > 0x07FF) {
out += String.fromCharCode(0xE0 | ((c >> 12) & 0x0F));
out += String.fromCharCode(0x80 | ((c >> 6) & 0x3F));
out += String.fromCharCode(0x80 | ((c >> 0) & 0x3F));
} else {
out += String.fromCharCode(0xC0 | ((c >> 6) & 0x1F));
out += String.fromCharCode(0x80 | ((c >> 0) & 0x3F));
}
}
return out;
}
var content = utf16to8(" I love you! ");
// $('#qrcode').qrcode("this plugin is great");
jQuery('#qrcode').qrcode(content);
$('#qrcode').qrcode({
width: 64,
height: 64,
text: "size doesn't matter"
});
</script>
</body>
</html>
边栏推荐
猜你喜欢
随机推荐
matlab特征点提取--记录自用
office2013以上输入数学公式
10 minute quick start EVs [play Huawei cloud]
Sleeping barber problem
CGAL编译错误
3. Print the linked list in reverse order with the array
Leetcode076 -- the kth largest number in the array
二维前缀和
Differences among pipes, pipe passes and pipe States
印度计划禁用中国电信设备!真离得开华为、中兴?
API 网关 APISIX 在Google Cloud T2A 和 T2D 的性能测试
16、字符串反转
leetcode——旋转数组的最小数字
What are the advantages of MRO purchasing website for industrial products? One article will help you understand
[openharmony] [rk2206] build openharmony compiler (2)
Arthas tutorial
12、双指针——合并两个有序链表
Description of landingsite electronic label quppa firmware entering DFU status
uni-app进阶之生命周期
[esp32][esp idf] ap+sta realizes wireless bridging and transferring WiFi signals

![[esp32][esp idf][lvgl7.9] failed to compile with OLED IIC](/img/16/e5aa43df6ef9bdbc173fa547c85559.png)




![[openharmony] [rk2206] build openharmony compiler (2)](/img/0c/2e8290403d64ec43d192969f776724.png)

