shopxo/application/index/controller/Qrcode.php

45 lines
1.5 KiB
PHP
Raw Normal View History

2018-12-28 18:58:37 +08:00
<?php
// +----------------------------------------------------------------------
// | ShopXO 国内领先企业级B2C免费开源电商系统
// +----------------------------------------------------------------------
// | Copyright (c) 2011~2018 http://shopxo.net All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: Devil
// +----------------------------------------------------------------------
namespace app\index\controller;
/**
* 二维码生成控制层
* @author Devil
* @blog http://gong.gg/
* @version 0.0.1
* @datetime 2016-12-01T21:51:08+0800
*/
class QrCode extends Common
{
/**
* [__construct 构造方法]
*/
public function __construct()
{
parent::__construct();
}
/**
* [Index 首页方法]
*/
public function Index()
{
require_once ROOT.'extend'.DS.'qrcode'.DS.'phpqrcode.php';
2019-01-08 12:56:07 +08:00
$params = input();
$level = isset($params['level']) && in_array($params['level'], array('L','M','Q','H')) ? $params['level'] : 'L';
$point_size = isset($params['size']) ? min(max(intval($params['size']), 1), 10) : 6;
$mr = isset($params['mr']) ? intval($params['mr']) : 1;
$content = isset($params['content']) ? urldecode(trim($params['content'])) : __MY_URL__;
2018-12-28 18:58:37 +08:00
\QRcode::png($content, false, $level, $point_size, $mr);
}
}
?>