提交 bb11f4bc 编写于 作者: 李光春's avatar 李光春

- 增加路由服务

上级 5e9b5e68
## v6.0.73 / 2020-07-09
- 增加路由服务
## v6.0.72 / 2020-07-09
- 删除网易云服务
......
......@@ -25,7 +25,7 @@ use think\db\exception\ModelNotFoundException;
/**
* 定义当前版本
*/
const VERSION = '6.0.72';
const VERSION = '6.0.73';
if (!function_exists('get_ip_info')) {
......
<?php
// +----------------------------------------------------------------------
// | ThinkLibrary 6.0 for ThinkPhP 6.0
// +----------------------------------------------------------------------
// | 版权所有 2017~2020 [ https://www.dtapp.net ]
// +----------------------------------------------------------------------
// | 官方网站: https://gitee.com/liguangchun/ThinkLibrary
// +----------------------------------------------------------------------
// | 开源协议 ( https://mit-license.org )
// +----------------------------------------------------------------------
// | gitee 仓库地址 :https://gitee.com/liguangchun/ThinkLibrary
// | github 仓库地址 :https://github.com/GC0202/ThinkLibrary
// | Packagist 地址 :https://packagist.org/packages/liguangchun/think-library
// +----------------------------------------------------------------------
namespace DtApp\ThinkLibrary\service;
use DtApp\ThinkLibrary\Service;
/**
* 路由服务
* Class RouteService
* @package DtApp\ThinkLibrary\service
*/
class RouteService extends Service
{
/**
* 跳转到某地址
* @param string $url
* @param int $status
* @param bool $parameter
*/
public function redirect(string $url, int $status = 302, bool $parameter = false)
{
if ($status === 302) header("Location: {$url}" . $parameter == true ? request()->query() : '');
elseif ($status == 301) {
header('HTTP/1.1 301 Moved Permanently');
header("Location: {$url}" . $parameter == true ? request()->query() : '');
}
}
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册