Home>Article>Backend Development> How to customize the generated QR code in PHP and jump to the address after scanning
A relatively simple PHP custom-generated QR code jump address. Scan the code on WeChat on the mobile phone to automatically jump to the defined link. Supports custom generation of QR code size, spacing, etc.
The QR code pop-up layer will be displayed when the mouse is hovering, and it will disappear after leaving it. js implementation, the code is as follows:
1 $(function() { 2 $("#btn_store").hover(function() { 3 var left = $(this).offset().left; 4 var top = $(this).offset().top; 5 var id = $(this).attr("data-id"); 6 $("#qrcode_box").css({ 7 "left": left, 8 "top": top + 31 9 }).show() 10 }, function() { 11 $("#qrcode_box").fadeOut(); 12 }) 13 })
Generate QR code:
1 include_once 'phpqrcode.php'; 2 3 $data = isset($_GET['url'])?$_GET['url']:"http://www.sucaihuo.com"; 4 // 纠错级别:L、M、Q、H 5 $level = 'L'; 6 // 点的大小:1到10,用于手机端4就可以了 7 $size = 7; 8 // 下面注释了把二维码图片保存到本地的代码,如果要保存图片,用$fileName替换第二个参数false 9 //$path = "images/"; 10 // 生成的文件名 11 //$fileName = $path.$size.'.png'; 12 $margin =0;//间距 13 QRcode::png($data, false, $level, $size,$margin);
Related tutorials:PHP video tutorial
The above is the detailed content of How to customize the generated QR code in PHP and jump to the address after scanning. For more information, please follow other related articles on the PHP Chinese website!