Php generates QRcode instances and phpqrcode instances

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.