PHP generates QR code program code_PHP tutorial

WBOY
Release: 2016-07-20 11:11:32
Original
1132 people have browsed it

There are many programs for generating QR codes on the Internet. We found that Google and some foreign websites provide plug-ins or APIs for generating QR codes for free. Let me introduce several to you.

The simplest and most practical goolge open source method

1.google open api

Example

The code is as follows
 代码如下 复制代码

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

widhtHeight="'.$size.'" widhtHeight="'.$size.'"/>';
}

Copy code

$urlToEncode="http://gz.altmi.com" ;

generateQRfromGoogle($urlToEncode);

function generateQRfromGoogle($chl,$widhtHeight ='150',$EC_level='L',$margin='0')

{

$url = urlencode($url);
echo 'QR code

代码如下 复制代码

include('./phpqrcode/phpqrcode.php');
// 二维码数据
$data = 'http://gz.altmi.com';
// 生成的文件名
$filename = $errorCorrectionLevel.'|'.$matrixPointSize.'.png';
// 纠错级别:L、M、Q、H
$errorCorrectionLevel = 'L';
// 点的大小:1到10
$matrixPointSize = 4;
QRcode::png($data, $filename, $errorCorrectionLevel, $matrixPointSize, 2);
?>

widhtHeight="'.$size.'" widhtHeight="'.$size.'"/>';

}

The above method is simple and fast, only a few sentences are enough, but there are some shortcomings It calls the Google server. If Google does not provide services, we will not be able to
. Let’s look at the

2.php class library PHP QR Code

Download: http://sourceforge.net/projects/phpqrcode/Example
The code is as follows Copy code
include( './phpqrcode/phpqrcode.php'); // QR code data $data = 'http://gz.altmi.com'; // Generated file name

$filename = $errorCorrectionLevel.'|'.$matrixPointSize.'.png'; // Error correction level: L, M, Q, H
$errorCorrectionLevel = 'L';
// Point Size: 1 to 10 <🎜> $matrixPointSize = 4; <🎜> QRcode::png($data, $filename, $errorCorrectionLevel, $matrixPointSize, 2); <🎜>?> This is pretty good and is saved on my own server. There are also some if you like: libqrencode and QRcode Perl CGI & PHP scripts QR code generation plug-in If you like it, you can take a look. http://www.bkjia.com/PHPjc/444636.htmlwww.bkjia.comtruehttp: //www.bkjia.com/PHPjc/444636.htmlTechArticleThere are many programs for generating QR codes on the Internet. We found that Google and some foreign websites provide them for free. There are plug-ins or APIs for generating QR codes. Let me introduce several to you. ...
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 Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!