Home>Article>Backend Development> PHP generates QR code image with background

PHP generates QR code image with background

angryTom
angryTom forward
2019-10-12 17:02:56 2406browse

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

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!

Statement:
This article is reproduced at:cnblogs.com. If there is any infringement, please contact admin@php.cn delete