Google Two-dimensional code PHP API

Source: Internet
Author: User
Tags php code

What is two-dimensional code:
Two-dimensional code is a two-dimensional barcode, can be the URL, text, photos and other information through the corresponding coding algorithm compiled into a block-shaped barcode pattern, mobile phone users can use the camera and decoding software to decode the relevant information and view the content.
Read mode:
Using 300,000 pictures of the camera phone, with the phone's QR code decoding software, the QR code a photo, decoding software will automatically read this message, displayed on the phone screen. At present there are also used to webcam lens to decode, it is expected that all the future of the lens of the technology products, will be imported into this QR code mechanism.

Two-dimensional barcode advantages:
1. Greater data capacity
2. Beyond the limits of alphanumeric
3. Small barcode Relative size
4. Have the ability to resist damage

Two-dimensional code generation

: https://chart.googleapis.com/chart?cht=qr&chs=150x150&choe=UTF-8&chld=L4&chl=http://blog.waphk.cn

Google Open API "PHP version"

Php <textarea data-settings="dblclick" readonly="" wrap="off"></textarea>
1 2 3 4 5 6 7 8 PHP Code $urlToEncode = "blog.php100.com"; Generateqrfromgoogle ($urlToEncode); function Generateqrfromgoogle ($chl, $widhtHeight = ' m ', $EC _level= ' L ', $margin = ' 0 ') {$url = UrlEncode ($url); Echo ' < IMG src= "https://chart.googleapis.com/chart?cht=qr&chs= '. $widhtHeight. ' x '. $widhtHeight. ' &chl= '. $chl. ' &chld= '. $EC _level. $margin. ' alt= ' QR code ' widhtheight= '. $size. ' widhtheight= '. $size. ' " /> '; }

Parameter 1 cht Specify a QR code
Parameter 2 CHS image size, which is said to generate picture size is 200x200, is wide x high. This is not the real size of the generated picture, it should be the maximum size.
Parameter 3 CHL The specified data, which is the information that is seen after decoding. When you include Chinese, use UTF-8 to encode Chinese characters, otherwise there will be a problem.
There are two optional parameters
Choe Encoding Default UTF8
CHLD Error Correction default 7% L represents the default error correction level, 4 represents the two-dimensional code boundary blank size, can be adjusted.



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.