Php code for generating QR code _ PHP Tutorial

Source: Internet
Author: User
Php generates QR code. The QR code generation program can be found on the internet. we have found many plug-ins or APIs for generating QR codes for free are provided on some foreign websites. I will introduce several types of them below. The QR code generation program can be found on the internet. we have found many plug-ins or APIs for generating QR codes for free are provided on some foreign websites. I will introduce several types of them below.

The simplest and most practical open-source goolge method

1. open APIs for google

Example

The code is as follows:

$ UrlToEncode = "http://gz.altmi.com ";
GenerateQRfromGoogle ($ urlToEncode );
Function generateQRfromGoogle ($ chlorophyll, $ widhtHeight = '000000', $ EC_level = 'l', $ margin = '0 ')
{
$ Url = urlencode ($ url );
Echo'

Chs = '. $ widhtHeight. 'X '. $ widhtHeight. '& cht = qr & chld = '. $ EC_level. '| '. $ margin. '& chlorophyll = '. $ chlorophyll. '"alt =" QR code"

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

The above method is simple and fast, just a few words. The disadvantage is that google server is called. if google does not provide services, we cannot

Now, let's look at it again.

2. php QR Code Library

Address: http://phpqrcode.sourceforge.net/
Download: http://sourceforge.net/projects/phpqrcode/

Example

The code is as follows:

Include ('./phpqrcode. php ');
// QR code data
$ Data = 'http: // gz.altmi.com ';
// Generated file name
$ Filename = $ errorCorrectionLevel. '| '.w.matrixpointsize.'.png ';
// Error correction level: L, M, Q, H
$ ErrorCorrectionLevel = 'l ';
// Vertex size: 1 to 10
$ MatrixPointSize = 4;
QRcode: png ($ data, $ filename, $ errorCorrectionLevel, $ matrixPointSize, 2 );
?>

This is not bad but saved on your own server. Some examples include libqrencode and QRcode Perl CGI & PHP scripts QR code generation plug-ins.

You can also take a look.


....

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.