增加http助手函数 改进App类

This commit is contained in:
thinkphp
2016-05-29 23:07:24 +08:00
parent eadaef6425
commit d122bad9b6
5 changed files with 18 additions and 6 deletions

View File

@@ -419,3 +419,14 @@ function redirect($url = [], $params = [], $code = 302)
}
return Response::create($url, 'redirect')->code($code)->params($params);
}
/**
* 抛出HTTP异常
* @param integer $code 状态码
* @param string $message 错误信息
* @param array $header 参数
*/
function http($code, $message = null, $header = [])
{
throw new \think\exception\HttpException($code, $message, null, $header);
}