sinri / ark-qr-builder
Ark 2 的 QR 生成组件
2.0
2024-05-11 09:58 UTC
Requires
- ext-gd: *
- ext-json: *
- psr/log: ~3.0
- sinri/ark-core: ~3.0
This package is auto-updated.
Last update: 2024-09-11 10:38:13 UTC
README
Ark 2 的 QR 生成组件。
使用方法
0x00. 创建 QRCode 实例
要生成 QRCode 实例,可以使用 \sinri\ark\qr\builder\ArkQRBuilder::makeQRInstance
或 \sinri\ark\qr\builder\ArkQRBuilder::quickMakeMinimumQRInstance
。
完整参数,快速生成器只需 1st 和 4th 参数。
- $data
- $mode 默认为 QRCode::QR_MODE_AUTO_DETECT,
- $type 默认为 4,
- $errorCorrectLevel 默认为 QRCode::QR_ERROR_CORRECT_LEVEL_L
它们可能返回一个参数,命名为 $qr
。
0x01. 获取矩阵
$qr->getQRMatrix();
0x02. 获取 HTML <table>
块
$qr->printHTML();
0x03. 输出为图像
// イメージ作成(引数:サイズ,マージン) $im = $qr->createImage(2, 4); header("Content-type: image/gif"); imagegif($im); imagedestroy($im);
基础
基于 kazuhikoarase/qrcode-generator in PHP,授权协议为 MIT。
//---------------------------------------------------------------
// QRCode for PHP5
//
// Copyright (c) 2009 Kazuhiko Arase
//
// URL: http://www.d-project.com/
//
// Licensed under the MIT license:
// https://open-source.org.cn/licenses/mit-license.php
//
// The word "QR Code" is registered trademark of
// DENSO WAVE INCORPORATED
// http://www.denso-wave.com/qrcode/faqpatent-e.html
//
//---------------------------------------------------------------------