QR code online generation of picture PHP source code_PHP tutorial

WBOY
Release: 2016-07-13 10:23:46
Original
1599 people have browsed it

QR code online generation of image PHP source code

QR code is becoming more and more popular now. Here we introduce the QR code generation code of PHP at both ends, a section of use Google's open QR code API is used, and the other section uses the PHP QR Code QR code open source class library, which is very simple.

 1. Use Google Chart API to generate QR code images

Google Chart API is a very powerful API, and generating QR codes is just a small function of it. Here we only introduce the QR code part. If you want to know more functions, you can log in to the official website address: http://code.google.com/intl/zh-CN/apis/chart/

The code is as follows:

$urlToEncode="http://www.weste.net";

generateQRfromGoogle($urlToEncode);

Function generateQRfromGoogle($chl,$widhtHeight ='150',$EC_level='L',$margin='0')

 {

 $url = urlencode($url);

echo 'QR code';

 }

 ?>

Generated QR code image:

 2. Use PHP QR Code to generate QR code images

PHP QR Code is an open source PHP QR code open source class library, based on the libqrencode C library, and provides API code to create QR barcode images, supporting png and jpg formats. It is powerful and very simple to use.

The demo code is as follows:

include "./phpqrcode/phpqrcode.php";

$value="http://www.weste.net";

 $errorCorrectionLevel = "L";

 $matrixPointSize = "4";

QRcode::png($value, false, $errorCorrectionLevel, $matrixPointSize);

exit;

 ?>

Generated QR code image:

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/834967.htmlTechArticle QR code to generate pictures online PHP source code QR code is becoming more and more popular now. Here are two QR code generation code using PHP. One section uses Google’s open QR code API, and the other section...
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
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!