当前位置:网站首页>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>
边栏推荐
- 谈谈基于JS实现阻止别人调试通过控制台调试网站的问题
- _HUGE and __IMP__HUGE in “math.h“
- Espresso systems, which has just obtained financing, has both intellectual property rights and team ethics in trouble
- 【JZOF】14剪绳子
- 第四步-用户开发环境设置
- ️雄关漫道真如铁,而今迈步从头越️
- [ESP32][esp-idf] AP+STA实现无线桥接 中转wifi信号
- 线程同步volatile与synchronized详解
- Sizebasedtriggingpolicy introduction
- In hot weather, the line of defense for safe production was strengthened, and Guangzhou Haizhu District carried out emergency drills for gas stations
猜你喜欢

What are the highlights of B2B2C system? How to help jewelry enterprises build an omni channel multi merchant mall management system

arthas使用教程

Digital construction of pharmaceutical industry is on the verge

Redis interview questions must be known and learned

二分、三分、01分数规划 【第I弹】

OSPF expansion configuration, routing principles, anti ring and re release

并查集

Flink - checkpoint Failure reason: Not all required tasks are currently running

What are the advantages of MRO purchasing website for industrial products? One article will help you understand

JS promotion: the underlying principle of flat tiling
随机推荐
API 网关 APISIX 在Google Cloud T2A 和 T2D 的性能测试
CGAL编译错误
Prometheus 运维工具 Promtool (四)TSDB 功能
Qt | 信号和槽的一些总结
【云驻共创】企业数字化转型,华为云咨询与你同行
How PHP gets the interface
OSPF expansion configuration, routing principles, anti ring and re release
TCP Basics
Kubernetes
Flink - checkpoint Failure reason: Not all required tasks are currently running
[OpenHarmony] [RK2206] 构建OpenHarmony编译器 (二)
LinkedList source massage, ah comfortable
[openharmony] [rk2206] build openharmony compiler (2)
腾讯技术专家:解密亿级用户产品 微信、QQ、王者荣耀...全面上云实践!
【MySQL】Got an error reading communication packets
[learning notes] border and period
JWT login authentication + token automatic renewal scheme, well written!
记录一次idea中的父子项目修改project与module名称,亲测!
Basic examples that must be mastered by beginners of C #
二维前缀和