Home > php教程 > php手册 > php使用qr生成二维码的示例分享

php使用qr生成二维码的示例分享

WBOY
Release: 2016-06-06 20:25:27
Original
1547 people have browsed it

二维码就是用在平面上用特定的几何图形记录数据信息的,QR码是常见的一种二维码。推荐使用生成QR码的php类库PHP QR Code,下面是使用示例

复制代码 代码如下:


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 = 'http://www.jb51.net'; // 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 'php使用qr生成二维码的示例分享'; 
?>

source:php.cn
Statement of this Website
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
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template