Home > Backend Development > PHP Tutorial > Implementation code of php QR code program

Implementation code of php QR code program

WBOY
Release: 2016-07-25 08:58:43
Original
1123 people have browsed it
  1. //google api
  2. $url="http://phperzj.sinaapp.com/";
  3. echo cre_QR($url);
  4. function cre_QR($chl,$widhtHeight =' 150',$EC_level='L',$margin='0'){
  5. $chl=urlencode($chl);
  6. $qr = '
  7. QR code
  8. ';
  9. return $qr;
  10. }
  11. ?>
Copy code

The parameter description is as follows: http://chart.apis.google.com/chart? : Call the Google Chart API cht=qr: Select to produce QR code &chs=100×100: Size &chld=L|4: L represents the default error correction level; 4 represents the blank size of the QR code boundary, which can be adjusted by yourself. &chl=: QR code content What's very considerate is that this API supports get and post

2.php class library PHP QR Code PHP QR Code is open source (LGPL) library for generating QR Code, 2-dimensional barcode. Based on libqrencode C library, provides API for creating QR Code barcode images (PNG, JPEG thanks to GD2). Implemented purely in PHP, with no external dependencies (except GD2 if needed). Address: http://phpqrcode.sourceforge.net/ Download: http://sourceforge.net/projects/phpqrcode/ illustrate: To install simply include: qrlib.php for full version (also you have to provide all library files form package plus cache dir) OR phpqrcode.php for merged version (only one file, but slower and less accurate code because disabled cache and quicker masking configured)

Then use it as follows: QRcode::png(‘code data text’, ‘filename.png’); // creates file QRcode::png(‘some othertext 1234′); // creates code image and outputs it directly into browser example:

  1. //PHP QR CODE
  2. //include("phpqrcode/qrlib.php");
  3. include("phpqrcode/phpqrcode.php");
  4. QRcode::png("http ://phperzj.sinaapp.com");
  5. ?>
Copy code

3.libqrencode

Address: http://fukuchi.org/works/qrencode/index.en.html For php support, please refer to: http://hirokawa.netflowers.jp/entry/4900/

4.QRcode Perl CGI & PHP scripts Address: http://www.swetake.com/qr/qr_cgi.html



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