Quickly generate QR codes with Google API

Source: Internet
Author: User
Tags urlencode

//laravel
Public functionindex () {$urlToEncode= "Http://www.baidu.com"; $this-Generateqrfromgoogle ($urlToEncode); //return view (' Welcame '); } Public functionGenerateqrfromgoogle ($chl,$widhtHeight= ' 150 ',$EC _level= ' L ',$margin= ' 0 ') { $chl=UrlEncode($chl); Echo' $widhtHeight.‘ X '.$widhtHeight.‘ &cht=qr&chld= '.$EC _level. ' | '.$margin.‘ &choe=utf-8&chl= '.$chl. ' "alt=" QR Code "widhtheight=".$widhtHeight.‘"widhtheight="‘.$widhtHeight.‘" /> '; }
//php
$urlToEncode= "Http://www.jb51.net"; Generateqrfromgoogle ($urlToEncode); /** * Google API QR code generation "QRCode can store up to 4,296 alphanumeric types of arbitrary text, you can view the QR code data format" * @param string $chl QR Code contains information, can be numbers, characters, binary information, Chinese characters. Data types cannot be mixed, data must go through UTF-8 url-encoded * @param int $widhtHeight dimension setting for QR code * @param string $EC _level Optional error correction level, QR code supports four levels of error correction to recover lost Missing, misread, fuzzy, data. * L-Default: can identify loss of 7% of data * M can identify loss of 15% of data * Q can identify lost 25% of the data * H can recognize the loss of 30% data * @param int $margin The resulting QR code distance from the picture border*/functionGenerateqrfromgoogle ($chl,$widhtHeight= ' 150 ',$EC _level= ' L ',$margin= ' 0 ') { $chl=UrlEncode($chl); Echo' $widhtHeight.‘ X '.$widhtHeight.‘ &cht=qr&chld= '.$EC _level. ' | '.$margin.‘ &choe=utf-8&chl= '.$chl. ' "alt=" QR Code "widhtheight=".$widhtHeight.‘"widhtheight="‘.$widhtHeight.‘" /> ';}

Quickly generate QR codes with Google API

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.