The php qr code generation example is generated using the PHPQRCode class library. with this example, we can generate a QR code as easily as echoa. here we will introduce it to you, I hope to help you. In the past, Google provided more... the php qr Code generation example is generated using the php qr Code class library. with this example, we can generate a QR Code as simple as echo a. Let's introduce it to you, I hope to help you.
In the past, Google provided a relatively complete interface for generating QR codes, which is easy to call. However, due to problems with accessing google, you need to use other methods to generate QR codes.
Php qr Code is a php qr Code generation class library that allows you to easily generate QR codes. the official website provides download and multiple demo demos,
Address: http://phpqrcode.sourceforge.net
After downloading the class library provided on the official website, you only need to use phpqrcode. php to generate a QR code. of course, you must enable GD2 in your PHP environment.
Qrlib. php is the full version. the official call example:
QRcode: png ('code data text', 'filename.png '); // creates fileQRcode: png ('Some othertext 1234 '); // creates code image and outputs it directly into browserphpqrcode. php is a merged version with only one file, but the generation speed is slow and inaccurate. Usage: phpqrcode. php provides a key png () method. Public static function png ($ text, $ outfile = false, $ level = QR_ECLEVEL_L, $ size = 3, $ margin = 4, $ saveandprint = false) {$ enc = QRencode :: factory ($ level, $ size, $ margin); return $ enc-> encodePNG ($ text, $ outfile, $ saveandprint = false );}
The parameter $ text indicates that two pieces of information text are generated. the parameter $ outfile indicates whether to output the two-dimensional code image file. the default value is no. the parameter $ level indicates the coverage rate, that is, the coverage area can also be identified, values: L (QR_ECLEVEL_L, 7%), M (QR_ECLEVEL_M, 15%), Q (QR_ECLEVEL_Q, 25%), and H (QR_ECLEVEL_H, 30%). The parameter $ size indicates the image size, the default value is 3. the parameter $ margin indicates the gap between blank areas in the border around the QR code. the default value is 4. the parameter $ saveandprint indicates whether to save and display the QR code. by default, the parameter is not saved.
Include 'phpqrcode. php ';
QRcode: png ('http: // mingzi.phprm.com '); the above code outputs a two-dimensional diagram.
In practice, we will add our own LOGO in the middle of the QR code to enhance the promotion effect. First, use the php qr Code to generate a QR Code image, and then use the php image function to add the prepared logo image to the middle of the generated original QR Code image, then generate a new QR code image. Of course, it is better to select the renewal rate H at this time.
Now we have generated the QR code image we want. we will not introduce it today due to limited time. next time we will introduce an address that uses it to generate the wap version of the website.
Article link:
Save this article for favorites!