php生成二维码的几种方式整理及使用实例

2025-03-22 15:12:41
推荐回答(1个)
回答1:

本文整理了一些php生成二维码的方式:1.google开放api;2.php类库PHP QR Code;3.libqrencode;4.QRcode Perl CGI & PHP scripts感兴趣的朋友可以参考下哈

1.google开放api

$urlToEncode="http://bbs.lewanchina.com";
generateQRfromGoogle($urlToEncode);
function generateQRfromGoogle($chl,$widhtHeight ='150',$EC_level='L',$margin='0')
{
$url = urlencode($url);
echo 'QR code';
}

2.php类库PHP QR Code

PHP QR Code is open source (LGPL) library for generating QR Code,
2-dimensional barcode. Based on libqrencode C library,
provides API for creating QR Code barcode images (PNG, JPEG thanks to GD2).
Implemented purely in PHP, with no external dependencies (except GD2 if needed).

include "./phpqrcode/phpqrcode.php";
$value="http://www.weste.net";
$errorCorrectionLevel = "L";
$matrixPointSize = "4";
QRcode::png($value, false, $errorCorrectionLevel, $matrixPointSize);
exit;
?>