二维码生成

1、首先在页面中加入jquery库文件和qrcode插件。

<script type="text/javascript" src="jquery.js"></script>  
<script type="text/javascript" src="jquery.qrcode.min.js"></script>

2、在页面中需要显示二维码的地方加入以下代码:

<div id="code"></div>  

3、调用qrcode插件。

qrcode支持canvas和table两种方式进行图片渲染,默认使用canvas方式,效率最高,当然要浏览器支持html5。直接调用如下:

$('#code').qrcode("http://xxx.com/wx/user/wx_reg?referee=${sessionScope.fguser.tel}&back_url=wx"); //任意字符串 

或者

$("#code").qrcode({  
    render: "table", //table方式  
     200, //宽度  
    height:200, //高度  
    text: "http://xxx.com/wx/user/wx_reg?referee=${sessionScope.fguser.tel}&back_url=wx" //任意内容  
});  
原文地址:https://www.cnblogs.com/dztHome/p/9076480.html