mirror of
https://gitee.com/fastadminnet/framework.git
synced 2026-07-01 12:42:48 +08:00
增加think\response\Xml 类和xml助手函数
This commit is contained in:
15
helper.php
15
helper.php
@@ -387,7 +387,7 @@ function view($template = '', $vars = [], $code = 200)
|
||||
* 获取\think\response\Json对象实例
|
||||
* @param mixed $data 返回的数据
|
||||
* @param integer $code 状态码
|
||||
* @param array $options 参数状
|
||||
* @param array $options 参数
|
||||
* @return \think\response\Json
|
||||
*/
|
||||
function json($data = [], $code = 200, $options = [])
|
||||
@@ -396,6 +396,19 @@ function json($data = [], $code = 200, $options = [])
|
||||
return $response->data($data)->code($code);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取\think\response\Xml对象实例
|
||||
* @param mixed $data 返回的数据
|
||||
* @param integer $code 状态码
|
||||
* @param array $options 参数
|
||||
* @return \think\response\Xml
|
||||
*/
|
||||
function xml($data = [], $code = 200, $options = [])
|
||||
{
|
||||
$response = new \think\response\Xml($options);
|
||||
return $response->data($data)->code($code);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取\think\response\Redirect对象实例
|
||||
* @param mixed $url 重定向地址 支持Url::build方法的地址
|
||||
|
||||
Reference in New Issue
Block a user