What is a two-dimensional code? Two-dimensional code is a two-dimensional barcode, can be the URL, text, photos and other information through the corresponding encoding algorithm compiled into a block-shaped barcode pattern, mobile phone users can use the camera and decryption software to re-decode the relevant information and view the content. # Two words to explain: # contains qrlib.php words need to put together with other files: files, folders. # phpqrcode.php is a merged version that only needs to contain this file, but the resulting picture is slow and less accurate # Here are two ways to use:
- Include ('./phpqrcode/phpqrcode.php ');
- Two-dimensional code data
- $data = ' http://bbs.it-home.org ';
- The generated file name
- $filename = $errorCorrectionLevel. ' | '. $matrixPointSize. " PNG ';
- Error correction level: L, M, Q, H
- $errorCorrectionLevel = ' L ';
- Size of point: 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 image to browser
- QRCode::p ng (' some othertext 1234 ');
- Creates code image and outputs it directly into browser
Copy CodeIf you generate color-coded code that requires you to modify the color settings section of the Qrimage class in Phpqrcode.php, 1.1.4 version of the Code on the No. 987, 988 lines, a foreground color, a background color:
- $col [0] = imagecolorallocate ($base _image,255,255,255);
- $col [1] = Imagecolorallocate ($base _image,0,0,0);
Copy CodeFor the use of QRCode, you can also refer to the article: PHP generated two-dimensional Code class library (QRCode method), PHP generated two-dimensional code image class QRCode 2, build with Google Open API
- $urlToEncode = "http://bbs.it-home.org";
- Generateqrfromgoogle ($urlToEncode);
- function Generateqrfromgoogle ($chl, $widhtHeight = ' Max ', $EC _level= ' L ', $margin = ' 0 ')
- {
- $url = UrlEncode ($url);
- Echo ';
- }
Copy CodeThe Google API to generate two-dimensional code, you can also refer to: PHP call Google interface to generate two-dimensional code instances, Google API generation QR code method Address: http://phpqrcode.sourceforge.net/Download: Http://sourceforge.net/projects/phpqrcode/3.libqrencode Address:/http fukuchi.org/works/qrencode/index.en.html 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 |