qrcode 生成二维码
qrcode 生成二维码
Demo:
qrcodeGithub 地址:
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>qrcode生成二维码</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="../plugins/bootstrap-4.1.3-dist/css/bootstrap.min.css">
<script src="../plugins/echarts/jquery.min.js"></script>
<script src="../plugins/bootstrap-4.1.3-dist/js/bootstrap.min.js"></script>
<script type="text/javascript" src="js/jquery.qrcode.min.js"></script>
</head>
<body>
<div class="alert alert-primary" role="alert" style="text-align: center;margin:10px;">
<b>生成的二维码如下:</b>
</div>
<div id="qrCodeDiv" style="text-align: center; margin:40px;">
<img id="qrCodeIco" src="logo.png" style="position: absolute;width: 64px; height: 64px;" />
</div>
</body>
<script type="text/javascript">
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;
};
$("#qrCodeDiv").qrcode({
render: "canvas", //渲染方式有table方式(IE兼容)和canvas方式
width: 260, //宽度
height: 260, //高度
text: utf16to8("https://www.cnblogs.com/hglibin/"), //内容
typeNumber: -1, //计算模式
correctLevel: 2, //二维码纠错级别
background: "#ffffff", //背景颜色
foreground: "#000000" //二维码颜色
});
var margin = ($("#qrCodeDiv").height() - $("#qrCodeIco").height()) / 2; //控制Logo图标的位置
$("#qrCodeIco").css("margin", margin);
</script>
</html>
运行结果:

qrcode 生成二维码的更多相关文章
- C# 利用QRCode生成二维码图片
网上生成二维码的组件是真多,可是真正好用的,并且生成速度很快的没几个,QRCode就是我在众多中找到的,它的生成速度快.但是网上关于它的使用说明,真的太少了,大都是千篇一律的复制粘贴.这是本要用它做了 ...
- Qrcode生成二维码的参数总结 及最小尺寸的测试
Qrcode生成二维码,做过很多实验,探索最小规格的二维码到底是多少尺寸,和最高规格的二维码到底是多大尺寸.现在我总结总结: 有两种思路: 1.生成规格高的二维码,然后压缩到自己想要的尺寸的二维码.这 ...
- 使用jquery.qrcode生成二维码及常见问题解决方案
转载文章 使用jquery.qrcode生成二维码及常见问题解决方案 一.jquery.qrcode.js介 jquery.qrcode.js 是一个纯浏览器 生成 QRcode 的 jQuery ...
- C#Qrcode生成二维码支持中文,带图片,带文字
C#Qrcode生成二维码支持中文带图片的操作请看二楼的帖子,当然开始需要下载一下C#Qrcode的源码 下载地址 : http://www.codeproject.com/Articles/2057 ...
- python_使用qrcode生成二维码
1.功能 使用qrcode生成二维码 2.代码 #生成二维码: import qrcode #根据url生成二维码 def qrcodeWithUrl(url): img = qrcode.make( ...
- 使用jquery.qrcode生成二维码实现微信分享功能
前言: 最近有个这样的需求,在pc端的商品详情页增加分享功能. 微博分享.QQ好友分享.QQ空间分享这些都很常见.但是微信分享我还没有手动写过(以前改过). 最终效果如下图: 解决方案:使用jquer ...
- QRCode生成二维码,jq QRCode生成二维码,QRCode生成电子名片
[QRCode官网]http://phpqrcode.sourceforge.net/ PHP QRCode生成二维码 官网下载QRCode源码包,引入源码包中的 qrlib.php . <?p ...
- 使用jquery.qrcode生成二维码(转)
jQuery 的 qrcode 插件就可以在浏览器端生成二维码图片. 这个插件的使用非常简单: 1.首先在页面中加入jquery库文件和qrcode插件. <script type=" ...
- 使用QRCode生成二维码
第一步: 获取QRCode组件 可以通过vs的nuget管理安装Gma.QrCodeNet, 也可以直接添加"Gma.QrCodeNet.Encoding.dll"的引用. 第二步 ...
随机推荐
- vmvare-centos7-vim
centos7网络连不上问题 http://geekflare.com/no-internet-connection-from-vmware-with-centos-7/ http://www.jia ...
- 【题解】期末考试 六省联考 2017 洛谷 P3745 BZOJ 4868 贪心 三分
题目传送门:这里是萌萌哒传送门(>,<) 啊♀,据说这题有个完全贪心的做法,但是要维护太多东西好麻烦的(>,<),于是就来口胡一发三分的做法. 思路很简单,假设我指定了一个x, ...
- java 关于值引用、地址引用的问题
8种基本引用类型 四种整数类型(byte.short.int.long) 两种浮点数类型(float.double) 一种字符类型(char) 一种布尔类型(boolean) 以及如String, f ...
- 不管谁坐了CIO的位置 都必须了解的法则
目前一些设立了CIO岗位的央企中,CIO也只做到了“IO”(信息官,Information Officer),而没有做到“C”(首席,Chief).老总们总在抱怨没有合适的人选:懂技术的不懂业务,懂业 ...
- codeforces 876 D. Sorting the Coins
http://codeforces.com/contest/876/problem/D D. Sorting the Coins time limit per test 1 second memory ...
- Emacs ^ Vim
Emacs存活: http://files.cnblogs.com/files/TheRoadToTheGold/Emacs%E2%80%94%E2%80%94%E5%AD%98%E6%B4%BB.z ...
- javascript操作对象的方法
with 确定某个对象的作用区域,在with代码段内的次对象的属性或方法可以直接使用. 例: //比如stu中有name,age属性和walk方法 with(stu) { alert(name+&qu ...
- HDU 1166 敌兵布阵 (树状数组 单点修改+区间查询)
题目链接 Problem Description C国的死对头A国这段时间正在进行军事演习,所以C国间谍头子Derek和他手下Tidy又开始忙乎了.A国在海岸线沿直线布置了N个工兵营地,Derek和T ...
- mysq配置
mysql运维 1.mysql配置文件:/etc/my.cnf mysql日记文件 :安装时候配置的,可以通过ps aux|grep mysqld 查询 ps aux|grep mysqld mysq ...
- NEERC2012
NEERC2012 A - Addictive Bubbles 题目描述:有一个\(n \times m\)的棋盘,还有不同颜色的棋子若干个,每次可以消去一个同种颜色的联通块,得到的分数为联通块中的棋 ...