Home >Backend Development >PHP Tutorial >PHP generates QR code image with background
Quickly produce QR code with background, it provides you with the following functions
Select Composer to install
$ composer require liheng/hart-qr-code
Use
use Hart\QrCode\HartQrcode; //初始化 /* * $url = 'http://www.baidu.com' * $path = "v1.png"; 背景地址 * $save = false; 是否保存到目录 */ $hartqrCode = new HartQrcode($url, $path, $save); //创建原始二维码 必须 $hartqrCode->create_qrcode($size = 200); //获取原始二维码 $hartqrCode->get_qrcode(); //创建带背景图的二维码 $hartqrCode->create_bg_qrcode($x = 260, $y = 700, $qrcode_size = 300); //获取带背景图带二维码 $hartqrCode->get_bg_qrcode(); //获取带背景图的二维码路径 如果没有创建带背景图的二维码 则获取的是原始二维码地址 $hartqrCode->get_qrcode_path();
The above is the detailed content of PHP generates QR code image with background. For more information, please follow other related articles on the PHP Chinese website!