Home > Backend Development > PHP Tutorial > Example of generating QR code (google api) online with PHP, googleapi_PHP tutorial

Example of generating QR code (google api) online with PHP, googleapi_PHP tutorial

WBOY
Release: 2016-07-13 10:23:54
Original
1266 people have browsed it

Example of PHP online generation of QR code code (google api), googleapi

Generate QR code online through google's online QR code generation api.

Code:





QR code generation-www.jbxue.com



body{text-align:center;background:#f5f5f5;line-height:22px;font-size:14px;color:#888;}
.newcrop{margin:10;}
. er{width:700px;margin:0px auto;border:1px solid gray}
span{background:#645;color:#fff}
body form {text-align:center;padding: 3px 6px 3px 6px ;}
input.txt{color: #00008B;background-color: #ADD8E6;border: 1px inset #00008B;width: 200px;}
input.btn {color: #00008B;background-color: # ADD8E6;border: 1px outset #00008B;padding: 2px 4px 2px 4px;}
input.smallInput{border:1 solid black;FONT-SIZE: 9pt; FONT-STYLE: normal; FONT-VARIANT: normal; FONT- WEIGHT: normal; HEIGHT: 18px; LINE-HEIGHT: normal}


< ?php
$content=$_GET['content'];
$width=$_GET['width']?$_GET['width']:300;
$height=$_GET[' height']?$_GET['height']:300;
if($content){
echo "The text you entered is: $content
echo "The width you selected is: $width
";
echo "The height you selected is: $height
";
echo "The generated QR code image 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 and send to your friends. Return to the previous page";
}else{
?> (Edited by Scripting School www.jbxue .com)


QR code generation tool


width:
height:


Enter URL or text:





< ;input type="submit" value="Generate image" />


< ;? }?>

Why is urlencode used in php to process strings through Google 2 Chinese characters

generated by QR code API

baiduMP3 encoding is GBK, your code is UTF8 encoded as GBK urlencode ('steps')= %BD%C5%B2%BD encoded as UTF8 urlencode(' Footsteps")= %E8%84%9A%E6%AD%A5 You have to use the iconv function to turn it

Is there a code to generate QR code in PHP website? JAVA is also fine

PHP QRCODE
You try it

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/833844.htmlTechArticleExample of PHP online generation of QR code code (google api), googleapi API for generating QR code online through google Generate QR code online. Code: !DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0...
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template