Home  >  Article  >  Backend Development  >  php生成QRcode实例_PHP

php生成QRcode实例_PHP

WBOY
WBOYOriginal
2016-05-31 19:29:371116browse

本文实例讲述了php生成QRcode实例。是一个非常有用的功能。分享给大家供大家参考。具体如下:

实例演示效果如下图所示:

主要功能代码如下:

<&#63;php 
ini_set('display_errors', 'on'); 
$PNG_TEMP_DIR = dirname(__FILE__).DIRECTORY_SEPARATOR.'temp'.DIRECTORY_SEPARATOR; 
$PNG_WEB_DIR = 'temp/'; 
 
include "qrlib.php";  // QRcode lib 
 
$data = 'demo qrcode'; // data 
$ecc = 'H'; // L-smallest, M, Q, H-best 
$size = 10; // 1-50 
 
$filename = $PNG_TEMP_DIR.'qrcode_'.time().'.png'; 
QRcode::png($data, $filename, $ecc, $size, 2); 
chmod($filename, 0777); 
echo '<img  src="'.$PNG_WEB_DIR.basename($filename).'" / alt="php生成QRcode实例_PHP" >'; 
&#63;>  

PHP QRcode Lib点击此处本站下载。

希望本文所述对大家的php程序设计有所帮助。

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn