Several ways to organize and use examples of PHP generating two-dimensional code

Source: Internet
Author: User
Tags php class

How HP generates QR Code: 1.google Open api;2.php class library PHP QR code;3.libqrencode;4.qrcode Perl CGI & PHP Scripts interested friends can refer to the next ha.

1.google Open API

The code is as follows:
$urlToEncode = "http://bbs.lewanchina.com"; 
Generateqrfromgoogle ($urlToEncode); Function Generateqrfromgoogle ($chl, $widhtHeight = ' ", $EC _level= ' L ', $margin = ' 0 ')  

$url = UrlEncode ($url);  
Echo ' ';  
} 



2.php class library PHP QR Code

PHP QR Code is the 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).
Address: http://phpqrcode.sourceforge.net/
Download: http://sourceforge.net/projects/phpqrcode/
Example:

The code is as follows:
<?&NBSP;
include "./phpqrcode/phpqrcode.php"; $value = "Http://www.weste.net"; $errorCorrectionLevel = "L"; $matrixPointSize = "4"; QRCode::p ng ($value, False, $errorCorrectionLevel, $matrixPointSize); Exit; &NBSP
? >&NBSP;


Home Address: http://phpqrcode.sourceforge.net/, the site can directly download the source code, download and extract to the Web directory, through the Web Access, you can see the demo demo.

Data indicates the number of records to be recorded if the Utf-8 encoding is stored in Chinese, up to 984.
ECC indicates the level of error correction, the higher the error correction level, the larger the image will be generated.
L Loadline of level 7% can be modified
Loadline of M level 15% can be corrected
Q-level 25% loadline can be corrected
The loadline of H level 30% can be corrected size to indicate the pixels of each black point of the picture.
Example of code invocation:

The code is as follows:
Include "qrlib.php";
QRCode::p ng ($data, $filename, $errorCorrectionLevel, $matrixPointSize, $margin);
/*
$data Data
$filename the name of the saved picture
$errorCorrectionLevel Error Handling level
$matrixPointSize pixels for each black point
$margin white border pixels outside the picture
*/


QR Code detailed principle can refer to the QR Wikipedia, the Chinese version of the relatively few, the English version of the introduction is very comprehensive, It is recommended to read the English version. &NBSP;
In addition, now the QR code already has the color version, but also can embed the individuality picture, I have done some research in this aspect, if has the interest, may contact me to communicate. My contact email reference site to the right column. &NBSP;

3.libqrencode&NBSP;
Address: Http://fukuchi.org/works/qrencode/index.en.html&NBSP;
PHP support please refer to: http ://hirokawa.netflowers.jp/entry/4900/&NBSP;

4.QRcode Perl CGI & PHP Scripts&NBSP;
Address: http://www.swetake.com/qr/qr_cgi.html

Several ways to organize and use PHP to generate two-dimensional code

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.