Home PHP Libraries Other libraries PHPqrCode class library for generating QR codes
PHPqrCode class library for generating QR codes
/**
 * 生成二维码
 * @param  string  $url  url连接
 * @param  integer $size 尺寸 纯数字
 */
function qrcode($url,$size=4){
    Vendor('Phpqrcode.phpqrcode');
    // 如果没有http 则添加
    if (strpos($url, 'http')===false) {
        $url='http://'.$url;
    }
    QRcode::png($url,false,QR_ECLEVEL_L,$size,2,false,0xFFFFFF,0x000000);
}

The first parameter $text; is the URL parameter in the above code;
The second parameter $outfile defaults to No; no file is generated; only the QR code image is returned; otherwise storage needs to be provided Path to generate QR code images;
The third parameter $level defaults to L; the values ​​that can be passed by this parameter are L(QR_ECLEVEL_L, 7%), M(QR_ECLEVEL_M, 15%), Q(QR_ECLEVEL_Q, 25 %), H(QR_ECLEVEL_H, 30%); this parameter controls the error tolerance rate of the QR code; different parameters indicate the percentage of the area that the QR code can cover. Taking advantage of the fault tolerance rate of QR code; we can place the avatar in any area of ​​the generated QR code image;
The fourth parameter $size; controls the size of the generated image; the default is 4;
The fifth Parameter $margin; controls the size of the blank area for generating QR codes;
The sixth parameter $saveandprint; saves the QR code image and displays it; $outfile must pass the image path;
The seventh parameter $back_color; Background color;
The eighth parameter $fore_color; the color of drawing QR code;

Disclaimer

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

PHP class library for generating QR codes (QRCode method) PHP class library for generating QR codes (QRCode method)

25 Jul 2016

PHP class library for generating QR codes (QRCode method)

phpqrcode class library generates QR code example code phpqrcode class library generates QR code example code

03 Mar 2018

This article mainly shares with you the phpqrcode class library to generate QR code example code, hoping to help everyone.

Generate QR code using PHP class library PHPqrCode Generate QR code using PHP class library PHPqrCode

07 Jul 2018

This article mainly introduces the use of PHP class library PHPqrCode to generate QR codes. It has certain reference value. Now I share it with you. Friends in need can refer to it.

Three solutions for not generating QR codes after Vue deployment Three solutions for not generating QR codes after Vue deployment

11 Apr 2023

When we reference some third-party libraries or plug-ins in the Vue project, sometimes we may encounter the problem that the QR code is not generated after deployment. This problem may cause us a lot of trouble and confusion, because QR codes have become a convenient and fast way to transmit information in the current mobile Internet era. So, why is there a problem that the QR code is not generated after the Vue project is deployed? This may be related to some detailed operations we have during the deployment process. Below we will introduce several possible solutions. Solution 1: Check whether the path is correct in the Vue project, 2

Tips for generating simple graphical verification codes using PHP and GD library Tips for generating simple graphical verification codes using PHP and GD library

13 Jul 2023

Tips for generating simple graphical verification codes using PHP and GD libraries. With the development of the Internet, preventing malicious attacks and abuse has become an indispensable part of website development. CAPTCHA is a technical means widely used to verify user identity and prevent malicious robots from registering and logging in. As a popular server-side programming language, PHP, combined with the GD library, can quickly generate simple graphical verification codes. 1. Introduction to GD library The GD library is an extension library of PHP. It provides a series of functions and methods for processing images. Through the GD library,

Introduction to the use of PHP QR Code, a class library for generating QR codes_PHP tutorial Introduction to the use of PHP QR Code, a class library for generating QR codes_PHP tutorial

14 Jul 2016

Introduction to the use of PHP QR Code, a class library for generating QR codes in PHP. QR codes are used to record data information with specific geometric figures on a flat surface. QR codes are a common two-dimensional code. The QR principle is relatively complicated to understand. If you deal with it yourself, it will probably cost a lot of money.

See all articles