当前位置:网站首页>PHP生成二维码(学习)
PHP生成二维码(学习)
2022-07-28 09:58:00 【你好旧时光】
php的基本写法:
<?php
echo "Hello World!";
?>
1二维码优点:(1)信息容量大
(2)编码范围广
(3)容错能力强
(4)驿码可靠性高
(5)可引入加密措施
(6)成本低,易制作
缺点:(1)二维码技术成为手机病毒、钓鱼网站传播的新渠道
(2)信息泄密
2. PHP生成QR Code
首先下载 phpqrcode类文件下载,下载地址:https://sourceforge.net/projects/phpqrcode/
然后把文件解压到项目文件下,最后在项目文件中新建PHP文件,在文件中写入如下代码即可生成二维码。

3.jq生成二维码
<!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">
//中文转换成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("我爱你");
// $('#qrcode').qrcode("this plugin is great");
jQuery('#qrcode').qrcode(content);
$('#qrcode').qrcode({
width: 64,
height: 64,
text: "size doesn't matter"
});
</script>
</body>
</html>
边栏推荐
- Redis面试题必知必会
- 1. 两数之和
- 我用小程序容器让移动研发效率提升了5倍!
- OSPF的不规则区域,LSA和序列号
- Which strings will be resolved to null by fastjason?
- [esp32][esp idf][lvgl7.9] failed to compile with OLED IIC
- 2022-uni-app解析token标准的方式-使用jsrsasign-爬坑过了
- 10分钟快速入门EVS【玩转华为云】
- [jzof] 14 cut rope
- Why should I take the first-class constructor examination? How high is the gold content of the first-class Constructor Certificate?
猜你喜欢

Redis interview questions must be known and learned

ADVANCE.AI出海指南助力企业出海印尼,掌握东南亚市场半边天

API 网关 APISIX 在Google Cloud T2A 和 T2D 的性能测试

Read Plato farm's eplato and the reason for its high premium

【JZOF】14剪绳子
![[esp32][esp idf] ap+sta realizes wireless bridging and transferring WiFi signals](/img/bf/0a968064a8f7c11b86a2a2820208e6.png)
[esp32][esp idf] ap+sta realizes wireless bridging and transferring WiFi signals

Voice chat app - how to standardize the development process?

Xiao Hei stands up again and looks at leetcode:653. Sum of two IV - enter BST

Guangzhou metro line 14 xinshixu station is under construction, and residents in Baiyun District are about to start a double line transfer mode!

Thinking and summary of technical personnel | R & D Efficiency
随机推荐
Boss: there are too many systems in the company. Can we realize account interworking?
JS promotion: the underlying principle of flat tiling
OSPF的拓展配置,选路原则,防环及重发布
Being on duty less than 8 hours a day and being dismissed? Tencent's former employees recovered 13million overtime pay, etc., and the court won a compensation of 90000 in the final judgment
头文件库文件
Etcd(高可用KV数据库)
New features of ES6
OSPF的LSA及优化
office2013以上输入数学公式
双指针技巧
The victory of Dao community, tiger Dao VC wins in governance and consensus
MySQL架构原理
Introduction to timebasedrollingpolicy
什么样的知识付费系统功能,更有利于平台与讲师发展?
Cloudcompare & PCL matching point sampling consistency suppression
leetcode——旋转数组的最小数字
Digital construction of pharmaceutical industry is on the verge
Installing MySQL for Linux operating system (centos7)
7.27 minimum spanning tree phased test problem solution
广州地铁14号线新市墟站开建,白云区居民即将开启双线换乘模式!