fuelqr / fuel-qrcode
导出二维码
dev-master
2016-07-22 10:41 UTC
Requires
- composer/installers: ~1.0
This package is not auto-updated.
Last update: 2024-09-18 18:45:51 UTC
README
作为一个 FuelPHP 包创建的 QRCode 库。
用法
加载 QRCode 包
// load the package \Package::load("qrcode");
直接输出二维码,用于视图内(外观不佳)
echo \QRCode::png('http://arrggghhh.steadweb.co.uk');
或将生成的二维码传递给视图
try { $file = time() . ".png"; $qrcode = ""; // generate the QRCode \QRCode::png('http://arrggghhh.steadweb.co.uk', $file, QR_ECLEVEL_L, 6, 4, false); // check the file has been generated // otherwise throw an exception if( ! is_file(DOCROOT . $file)) { throw new Exception("Unable to generate QR code"); } $qrcode = Asset::img(Uri::create("/" . $file)) } catch(\Exception $e) { // log the error Log::error($e->getMessage()); // show something, atleast $qrcode = "QRCode wasn't generated, derp."; } return \View::forge("qrcode", array("qr" => $qrcode), false);