PHP Online generation QR code (Google API) example, googleapi_php tutorial

Source: Internet
Author: User

PHP Online generation QR code (Google API) example, GOOGLEAPI


Generate two-dimensional code online via the API generated by Google online.

Code:





<title>Two-dimensional code generation-www.jbxue.com</title>





$content =$_get[' content ';
$width =$_get[' width ']?$_get[' width ']:300;
$height =$_get[' height ']?$_get[' height ']:300;
if ($content) {
echo "The text you typed is:$content
";
echo "The width you choose is:$width
";
echo "The height of your choice is:$height
";
echo "generates a QR code image that is:
";
$wen = UrlEncode (mb_convert_encoding ($content, ' utf-8 ', ' gb2312 ')). "";
echo "

Image address: https://chart.googleapis.com/chart?cht=qr&chld=h&chs={$width}x{$height}&chl={$wen}

Copy to your friend. Go back to the previous page ";
}else{
?> (Script Academy edit finishing Www.jbxue.com)


Why PHP uses the UrlEncode processing string to generate two-dimensional code from the Google QR Code API to obtain Chinese characters

Baidu MP3 encoding is GBK, your code inside is UTF8 encoding for GBK urlencode (' footsteps ') =%BD%C5%B2%BD encoded as UTF8 urlencode (' footstep ') =%e8%84 %9A%E6%AD%A5 you have to use the Iconv function to turn around.

Do you have code that generates a QR code within a PHP site? Java is also a line

PHP QRCode
You give it a try

http://www.bkjia.com/PHPjc/833844.html www.bkjia.com true http://www.bkjia.com/PHPjc/833844.html techarticle php online generation of QR code (Google API) example, GOOGLEAPI through the Google online generation QR Code API online generation of QR code. Code:! DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 ...

  • 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.