PHP class library PHP QR Code
# Two words to explain:
# contains qrlib.php words need to be put together with other files: files, folders.
# phpqrcode.php is a merged version that only needs to contain this file, but the resulting image is slow and inaccurate
# Here are two ways to use it:
| The code is as follows |
Copy Code |
|
<?php
Include ('./phpqrcode/phpqrcode.php ');
Two-dimensional code data
$data = ' http://gz.altmi.com ';
The file name that was generated
$filename = $errorCorrectionLevel. ' | '. $matrixPointSize. ' PNG ';
Error correction level: L, M, Q, H
$errorCorrectionLevel = ' L ';
Point size: 1 to 10
$matrixPointSize = 4;
QRCode::p ng ($data, $filename, $errorCorrectionLevel, $matrixPointSize, 2);
?>
# Create a two-dimensional code file
QRCode::p ng (' Code data text ', ' filename.png ');
Creates file
# Generate pictures to Browser
QRCode::p ng (' some othertext 1234 ');
Creates code image and outputs it directly into browser |
If there's a color to build, do it yourself.
To modify the code for the color Settings section of the Qrimage class in phpqrcode.php, the 1.1.4 version of the code is in line No. 987, 988, one foreground, one background color:
| The code is as follows |
Copy Code |
$col [0] = imagecolorallocate ($base _image,255,255,255);
$col [1] = Imagecolorallocate ($base _image,0,0,0); |
Can
Using the Google Open API to generate
| code is as follows |
copy code |
|
$urlToEncode = "http://gz.altmi.com";
Generateqrfromgoogle ($urlToEncode);
Function Generateqrfromgoogle ($chl, $widhtHeight = ' i ', $EC _level= ' L ', $margin = ' 0 ')
{
$url = UrlEncode ($url);
echo ' ';
} |