A QR code is a two-dimensional barcode. You can compile the URL, text, photos, and other information into a square-shaped barcode pattern using the corresponding encoding algorithm, mobile phone users can re-decode the related information and view the content through cameras and decoding software.
Php class library php qr Code
# Two sentences:
# Put qrlib. php together with other files: files and folders.
# Phpqrcode. php is a merged version. You only need to include this file, but the generated image is slow and inaccurate.
# The following two usage methods are provided:
| The Code is as follows: |
Copy code |
|
<? Php
Include ('./phpqrcode. php ');
// QR code data
$ Data = 'HTTP: // gz.altmi.com ';
// Generated file name
$ Filename = $ errorCorrectionLevel. '| '.w.matrixpointsize.'.png ';
// Error Correction level: L, M, Q, H
$ ErrorCorrectionLevel = 'l ';
// Vertex size: 1 to 10
$ MatrixPointSize = 4;
QRcode: png ($ data, $ filename, $ errorCorrectionLevel, $ matrixPointSize, 2 );
?>
# Create a QR code file
QRcode: png ('Code data text', 'filename.png ');
// Creates file
# Generating images to the browser
QRcode: png ('some othertext 1234 ');
// Creates code image and outputs it directly into browser |
If you generate a colorful image, you must do it yourself.
Modify the color setting code in the image Method of QRimage class in phpqrcode. php. The code for version 1.1.4 is in lines 987th and 988, with a foreground color and a background color:
| The Code is as follows: |
Copy code |
$ Col [0] = ImageColorAllocate ($ base_image, 255,255,255 );
$ Col [1] = ImageColorAllocate ($ base_image, 0, 0 ); |
You can.
Use google open api to generate
| The Code is as follows: |
Copy code |
|
$ UrlToEncode = "http://gz.altmi.com ";
GenerateQRfromGoogle ($ urlToEncode );
Function generateQRfromGoogle ($ chlorophyll, $ widhtHeight = '000000', $ EC_level = 'l', $ margin = '0 ')
{
$ Url = urlencode ($ url );
Echo ' ';
} |