Php generates QRcode instances and phpqrcode instances
This example describes how to generate a QRcode instance using php. Is a very useful feature. Share it with you for your reference. The details are as follows:
Shows the instance demo effect:
The main function code is as follows:
<?php ini_set('display_errors', 'on'); $PNG_TEMP_DIR = dirname(__FILE__).DIRECTORY_SEPARATOR.'temp'.DIRECTORY_SEPARATOR; $PNG_WEB_DIR = 'temp/'; include "qrlib.php"; // QRcode lib $data = 'demo qrcode'; // data $ecc = 'H'; // L-smallest, M, Q, H-best $size = 10; // 1-50 $filename = $PNG_TEMP_DIR.'qrcode_'.time().'.png'; QRcode::png($data, $filename, $ecc, $size, 2); chmod($filename, 0777); echo ''; ?>
Click here to download PHP QRcode Lib.
I hope this article will help you with php programming.
How can I wrap the output result with a QR code generated by phpqrcode?
Use \ r as in PHP.
Php QR code generation methods
.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); Official Use Case: <? Php # include one of the two files:/* qrlib. phpforfullversion (alsoyouhavetoprovidealllibraryfilesformpackagepluscachedir) ORphpqrcode. phpformergedversion (onlyonefile, butslowerandlessaccuratecodebecausedisabledcacheandquickermaskingconfigured) */# two sentences: # Including qrlib. php needs to be put 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: # create a QR code file QRcode :: png ('codedatatext ', # generate an image to the browser QRcode: png ('someothertext1234'); // createscodeimageandoutputsitdirectly+browser