<?php undation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA echo "<h1>PHP QR Code</h1><hr/>"; //set it to writable location, a place for temp generated PNG files $PNG_TEMP_DIR = dirname(__FILE__).DIRECTORY_SEPARATOR.'temp'.DIRECTORY_SEPARATOR; //html PNG location prefix $PNG_WEB_DIR = 'temp/'; include "qrlib.php"; //ofcourse we need rights to create temp dir if (!file_exists($PNG_TEMP_DIR)) mkdir($PNG_TEMP_DIR); $filename = $PNG_TEMP_DIR.'test.png'; $errorCorrectionLevel = 'L'; if (isset($_REQUEST['level']) && in_array($_REQUEST['level'], array('L','M','Q','H'))) $errorCorrectionLevel = $_REQUEST['level']; $matrixPointSize = 4; if (isset($_REQUEST['size'])) $matrixPointSize = min(max((int)$_REQUEST['size'], 1), 10);
Our QR code generation class first requires that your PHP environment must be enabled to support GD2. It provides a key png() method, in which the parameter $text indicates the generation of two-digit information text; the parameter $outfile indicates whether to output a QR code image file, the default is no; the parameter $level indicates the fault tolerance rate, that is, whether The covered areas can also be identified, which are L (QR_ECLEVEL_L, 7%), M (QR_ECLEVEL_M, 15%), Q (QR_ECLEVEL_Q, 25%), H (QR_ECLEVEL_H, 30%); the parameter $size indicates the size of the generated image, the default It is 3; the parameter $margin indicates the spacing value of the blank area of the border around the QR code; the parameter $saveandprint indicates whether to save the QR code and display it.
All resources on this site are contributed by netizens or reprinted by major download sites. Please check the integrity of the software yourself! All resources on this site are for learning reference only. Please do not use them for commercial purposes. Otherwise, you will be responsible for all consequences! If there is any infringement, please contact us to delete it. Contact information: admin@php.cn
Related Article
21Jun2023
As an indispensable part of today's smartphones and other electronic devices, QR codes are used more and more widely. In web development, using QR codes can improve user experience and facilitate operations such as sharing and scanning. This article will introduce how to use functions in PHP to obtain QR codes. In PHP, we can use third-party libraries to generate QR codes, among which the more commonly used one is the PHPQRCode library. This library has good compatibility and convenient use, we only need to download and reference it in the project. Below, we
25Jul2016
PHP QR Code barcode and QR code generation class library
29Jul2016
:This article mainly introduces HP QR Code, a PHP QR code generation library. Students who are interested in PHP tutorials can refer to it.
13Jul2016
php uses PHP QR Code to generate a QR code (with logo). We need to use some class libraries to generate QR codes. Let me introduce how to use PHP QR Code to generate QR codes. The generation method is very simple. Let me introduce it below. Utilize php classes
13Jul2016
PHP生成二维码库phpqrcode。Description PHP QR Code is open source (LGPL) library for generating QR Code, 2-dimensional barcode. Based on libqrencode C library, provides API for creating QR Code barcode image
21Nov2016
Quote [Introduction] QR code is a type of two-dimensional barcode. It can compile website addresses, text, photos and other information into a square barcode pattern through corresponding encoding algorithms. Mobile phone users can re-decode the relevant information through the camera and decoding software. And view the content php class library PHP QR Code two-sentence explanation: QR code is a type of two-dimensional barcode. It can compile website addresses, text, photos and other information into a square barcode pattern through corresponding encoding algorithms. Mobile phone users can Re-decode the relevant information through the camera and decoding software and view the content php class library PHP...
Hot Tools
PHP library for dependency injection containers
PHP library for dependency injection containers
A collection of 50 excellent classic PHP algorithms
Classic PHP algorithm, learn excellent ideas and expand your thinking
Small PHP library for optimizing images
Small PHP library for optimizing images