Several ways of generating two-dimensional code in PHP and its application _php skills

Source: Internet
Author: User

1.google Open API

Copy Code code as follows:

$urlToEncode = "http://bbs.lewanchina.com";
Generateqrfromgoogle ($urlToEncode);
function Generateqrfromgoogle ($chl, $widhtHeight = ' _level= ', $EC ' L ', $margin = ' 0 ')
{
$url = UrlEncode ($url);
Echo ' ';
}


2.php class library PHP QR Code

The 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-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/
Instance:
Copy Code code as follows:

?
Include "./phpqrcode/phpqrcode.php";
$value = "Http://www.weste.net";
$errorCorrectionLevel = "L";
$matrixPointSize = "4";
QRCode::p ng ($value, False, $errorCorrectionLevel, $matrixPointSize);
Exit
?>

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

Data represents the number of records to be recorded, if it is stored utf-8 encoded in Chinese, up to 984.
ECC indicates the level of error correction, the higher the level of error correction, the larger the picture will be generated.
L level 7% codewords can be corrected.
Codewords of M level 15% can be corrected
Q level 25% of codewords can be modified
The codewords of H level 30% can be modified to represent the pixels of each black dot in the picture.
Example of code invocation:
Copy Code code as follows:

Include "qrlib.php";
QRCode::p ng ($data, $filename, $errorCorrectionLevel, $matrixPointSize, $margin);
/*
$data data
Name of $filename saved picture
$errorCorrectionLevel Error Handling level
$matrixPointSize pixels for each black dot
$margin white border pixels around a picture
*/

QR Code detailed principle can refer to QR Wikipedia, the Chinese version introduction is relatively few, the English version introduction is very comprehensive, the recommendation looks English edition.
In addition, now QR code has a color version of the, can also embed personality pictures, I have done some research in this area, if interested, you can contact me and exchange. My contact email reference site to the right column.

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

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

PS: Here again to provide a two-dimensional site code tools (with logos and a variety of custom functions), the function is very powerful! Free for everyone to use:

Http://tools.jb51.net/transcoding/jb51qrcode

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.