How does php generate a QR code?

Source: Internet
Author: User
Since ios and Android quickly occupied the market, the QR code has been quickly filled up. Similarly, while we are using php for php development, we must first think of the issue of generating the QR code, so where is a good start?

Since ios and Android quickly occupied the market, the QR code has been quickly filled up. Similarly, while we are using php for php development, we must first think of the issue of generating the QR code, so where is a good start?

What should I do? in fact, Google has opened the corresponding api

Don't believe you can try http://chart.apis.google.com/chart? Cht = qr & chs = 100x100 & chlorophyll = phpslight

Http://chart.apis.google.com/chart? : Call the Google Chart API

  1. Cht = qr
    This is required. tell the API that you need to generate a QR code.
  2. Chs = X
    This is also necessary to inform the API of the size of the QR code you need to generate.
  3. Chlorophyll =
    This is required to tell the information contained in the api qr code. It can be numbers, character numbers, characters, binary information, and Chinese characters. The data type cannot be mixed. Data must go through the UTF-8 URL-encoded. If the information to be transmitted exceeds 2 K bytes, use the POST method.
  4. Choe =
    Finally come a not necessary, this is used to declare the generated QR code contains information encoding, the default is UTF-8; other optional encoding is Shift_JIS, ISO-8859-1
  5. Chld = |
    Optional error correction level. QR codes support four levels of error correction to restore lost, read-wrong, fuzzy, and data. The following are optional values: L-(default) can identify data with 7% loss; M-can identify data with 15% loss; Q-can identify data with 25% loss; h-identifies 30% of data loss. Margin refers to the distance between the generated QR code and the image border.

The QR code is square and has the same length and width. The QR code is fixed in size: the length/width from 21 to 177, increasing by 4 pixels each time. Each configuration is called a level. The larger the length and width, the more information is stored. Below is the version summary:

  • The QR code with a level of 1 is 21 pixels in length and width. up to 25 letters, numbers, and characters can be stored.
  • The QR code with a level of 2 is 25 pixels in length and width. a maximum of 47 letters, numbers, and characters can be stored.
  • ... And so on.

The Chart API determines the level of QR code to use based on the size of the information you store. The best QR code reader can read information stored in a QR code of 40. Generally, however, mobile devices can read a maximum of 4 QR codes.

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.