php生成二维码
require_once 'phpqrcode.php';
set_time_limit(0);
// 二维码内容
$value = $_REQUEST ["QRCodeContent"];
// 容错级别
$errorCorrectionLevel = 'Q'; // L,M,Q,H
$levels = array("L", "M", "Q", "H");
if (isset ($_REQUEST ["level"]) && in_array($_REQUEST ["level"], $levels)) {
$errorCorrectionLevel = $_REQUEST ["level"];
}
// 生成图片大小
$matrixPointSize = 10;
if (isset($_REQUEST["size"])) {
$matrixPointSize = $_REQUEST["size"];
if ($matrixPointSize <= 4) {
$matrixPointSize = 4;
} elseif ($matrixPointSize > 100) {
$matrixPointSize = 100;
}
}
$path = md5($value) . ".png";
// 生成二维码图片
QRcode::png($value, $path, $errorCorrectionLevel, $matrixPointSize, 2);
$path 为生成二维码文件的位置