php 二维码生成

php 二维码生成

使用php类库PHP QR Code

类库下载:http://sourceforge.net/projects/phpqrcode/

类库中有个index.php中是实例

 

<?php
/*
*  Author : liuying
*  Url    : http://www.86shichang.com
*/
 include('./phpqrcode.php');
   // 二维码数据
   $data = 'http://www.86shichang.com';
   // 纠错级别:L、M、Q、H
   $errorCorrectionLevel = 'L';
    // 点的大小:1到10
   $matrixPointSize = 4;
   // 生成的文件名
   $path = "erwei/";
   if (!file_exists($path)){
        mkdir($path);
   }
   $filename = $path.$errorCorrectionLevel.'.'.$matrixPointSize.'.png';
   QRcode::png($data, $filename, $errorCorrectionLevel, $matrixPointSize, 2);
   echo "<img src='$filename' />";

?>

 

 

你可能感兴趣的:(PHP)