PHP generates QR code image with background

angryTom
Release: 2023-04-07 15:14:02
forward
2529 people have browsed it

Hart QR Code

Quickly produce QR code with background, it provides you with the following functions

  • Produce original QR code, you can Configure url or text, and QR code size
  • Produce QR code with background. The background size is the size you pass in with background. You can configure the original QR code size. The original QR code is in the background. When the location is
  • , you can directly return the QR code, or you can save it to the path to install

Installation (recommended learning: php tutorial)

Select Composer to install

$ composer require liheng/hart-qr-code
Copy after login

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();
Copy after login

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!

Related labels:
source:cnblogs.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!