|
@@ -160,8 +160,8 @@ class Request
|
|
|
/**
|
|
/**
|
|
|
* Hook 方法注入
|
|
* Hook 方法注入
|
|
|
* @access public
|
|
* @access public
|
|
|
- * @param string|array $method 方法名
|
|
|
|
|
- * @param mixed $callback callable
|
|
|
|
|
|
|
+ * @param string|array $method 方法名
|
|
|
|
|
+ * @param mixed $callback callable
|
|
|
* @return void
|
|
* @return void
|
|
|
*/
|
|
*/
|
|
|
public static function hook($method, $callback = null)
|
|
public static function hook($method, $callback = null)
|
|
@@ -202,13 +202,13 @@ class Request
|
|
|
/**
|
|
/**
|
|
|
* 创建一个URL请求
|
|
* 创建一个URL请求
|
|
|
* @access public
|
|
* @access public
|
|
|
- * @param string $uri URL地址
|
|
|
|
|
- * @param string $method 请求类型
|
|
|
|
|
- * @param array $params 请求参数
|
|
|
|
|
- * @param array $cookie
|
|
|
|
|
- * @param array $files
|
|
|
|
|
- * @param array $server
|
|
|
|
|
- * @param string $content
|
|
|
|
|
|
|
+ * @param string $uri URL地址
|
|
|
|
|
+ * @param string $method 请求类型
|
|
|
|
|
+ * @param array $params 请求参数
|
|
|
|
|
+ * @param array $cookie
|
|
|
|
|
+ * @param array $files
|
|
|
|
|
+ * @param array $server
|
|
|
|
|
+ * @param string $content
|
|
|
* @return \think\Request
|
|
* @return \think\Request
|
|
|
*/
|
|
*/
|
|
|
public static function create($uri, $method = 'GET', $params = [], $cookie = [], $files = [], $server = [], $content = null)
|
|
public static function create($uri, $method = 'GET', $params = [], $cookie = [], $files = [], $server = [], $content = null)
|
|
@@ -415,7 +415,7 @@ class Request
|
|
|
foreach (Config::get('pathinfo_fetch') as $type) {
|
|
foreach (Config::get('pathinfo_fetch') as $type) {
|
|
|
if (!empty($_SERVER[$type])) {
|
|
if (!empty($_SERVER[$type])) {
|
|
|
$_SERVER['PATH_INFO'] = (0 === strpos($_SERVER[$type], $_SERVER['SCRIPT_NAME'])) ?
|
|
$_SERVER['PATH_INFO'] = (0 === strpos($_SERVER[$type], $_SERVER['SCRIPT_NAME'])) ?
|
|
|
- substr($_SERVER[$type], strlen($_SERVER['SCRIPT_NAME'])) : $_SERVER[$type];
|
|
|
|
|
|
|
+ substr($_SERVER[$type], strlen($_SERVER['SCRIPT_NAME'])) : $_SERVER[$type];
|
|
|
break;
|
|
break;
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
@@ -496,8 +496,8 @@ class Request
|
|
|
/**
|
|
/**
|
|
|
* 设置资源类型
|
|
* 设置资源类型
|
|
|
* @access public
|
|
* @access public
|
|
|
- * @param string|array $type 资源类型名
|
|
|
|
|
- * @param string $val 资源类型
|
|
|
|
|
|
|
+ * @param string|array $type 资源类型名
|
|
|
|
|
+ * @param string $val 资源类型
|
|
|
* @return void
|
|
* @return void
|
|
|
*/
|
|
*/
|
|
|
public function mimeType($type, $val = '')
|
|
public function mimeType($type, $val = '')
|
|
@@ -512,7 +512,7 @@ class Request
|
|
|
/**
|
|
/**
|
|
|
* 当前的请求类型
|
|
* 当前的请求类型
|
|
|
* @access public
|
|
* @access public
|
|
|
- * @param bool $method true 获取原始请求类型
|
|
|
|
|
|
|
+ * @param bool $method true 获取原始请求类型
|
|
|
* @return string
|
|
* @return string
|
|
|
*/
|
|
*/
|
|
|
public function method($method = false)
|
|
public function method($method = false)
|
|
@@ -626,9 +626,9 @@ class Request
|
|
|
/**
|
|
/**
|
|
|
* 获取当前请求的参数
|
|
* 获取当前请求的参数
|
|
|
* @access public
|
|
* @access public
|
|
|
- * @param string|array $name 变量名
|
|
|
|
|
- * @param mixed $default 默认值
|
|
|
|
|
- * @param string|array $filter 过滤方法
|
|
|
|
|
|
|
+ * @param string|array $name 变量名
|
|
|
|
|
+ * @param mixed $default 默认值
|
|
|
|
|
+ * @param string|array $filter 过滤方法
|
|
|
* @return mixed
|
|
* @return mixed
|
|
|
*/
|
|
*/
|
|
|
public function param($name = '', $default = null, $filter = '')
|
|
public function param($name = '', $default = null, $filter = '')
|
|
@@ -664,15 +664,16 @@ class Request
|
|
|
/**
|
|
/**
|
|
|
* 设置获取路由参数
|
|
* 设置获取路由参数
|
|
|
* @access public
|
|
* @access public
|
|
|
- * @param string|array $name 变量名
|
|
|
|
|
- * @param mixed $default 默认值
|
|
|
|
|
- * @param string|array $filter 过滤方法
|
|
|
|
|
|
|
+ * @param string|array $name 变量名
|
|
|
|
|
+ * @param mixed $default 默认值
|
|
|
|
|
+ * @param string|array $filter 过滤方法
|
|
|
* @return mixed
|
|
* @return mixed
|
|
|
*/
|
|
*/
|
|
|
public function route($name = '', $default = null, $filter = '')
|
|
public function route($name = '', $default = null, $filter = '')
|
|
|
{
|
|
{
|
|
|
if (is_array($name)) {
|
|
if (is_array($name)) {
|
|
|
- $this->param = [];
|
|
|
|
|
|
|
+ $this->param = [];
|
|
|
|
|
+ $this->mergeParam = false;
|
|
|
return $this->route = array_merge($this->route, $name);
|
|
return $this->route = array_merge($this->route, $name);
|
|
|
}
|
|
}
|
|
|
return $this->input($this->route, $name, $default, $filter);
|
|
return $this->input($this->route, $name, $default, $filter);
|
|
@@ -681,9 +682,9 @@ class Request
|
|
|
/**
|
|
/**
|
|
|
* 设置获取GET参数
|
|
* 设置获取GET参数
|
|
|
* @access public
|
|
* @access public
|
|
|
- * @param string|array $name 变量名
|
|
|
|
|
- * @param mixed $default 默认值
|
|
|
|
|
- * @param string|array $filter 过滤方法
|
|
|
|
|
|
|
+ * @param string|array $name 变量名
|
|
|
|
|
+ * @param mixed $default 默认值
|
|
|
|
|
+ * @param string|array $filter 过滤方法
|
|
|
* @return mixed
|
|
* @return mixed
|
|
|
*/
|
|
*/
|
|
|
public function get($name = '', $default = null, $filter = '')
|
|
public function get($name = '', $default = null, $filter = '')
|
|
@@ -693,6 +694,7 @@ class Request
|
|
|
}
|
|
}
|
|
|
if (is_array($name)) {
|
|
if (is_array($name)) {
|
|
|
$this->param = [];
|
|
$this->param = [];
|
|
|
|
|
+ $this->mergeParam = false;
|
|
|
return $this->get = array_merge($this->get, $name);
|
|
return $this->get = array_merge($this->get, $name);
|
|
|
}
|
|
}
|
|
|
return $this->input($this->get, $name, $default, $filter);
|
|
return $this->input($this->get, $name, $default, $filter);
|
|
@@ -701,9 +703,9 @@ class Request
|
|
|
/**
|
|
/**
|
|
|
* 设置获取POST参数
|
|
* 设置获取POST参数
|
|
|
* @access public
|
|
* @access public
|
|
|
- * @param string $name 变量名
|
|
|
|
|
- * @param mixed $default 默认值
|
|
|
|
|
- * @param string|array $filter 过滤方法
|
|
|
|
|
|
|
+ * @param string $name 变量名
|
|
|
|
|
+ * @param mixed $default 默认值
|
|
|
|
|
+ * @param string|array $filter 过滤方法
|
|
|
* @return mixed
|
|
* @return mixed
|
|
|
*/
|
|
*/
|
|
|
public function post($name = '', $default = null, $filter = '')
|
|
public function post($name = '', $default = null, $filter = '')
|
|
@@ -717,7 +719,8 @@ class Request
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
if (is_array($name)) {
|
|
if (is_array($name)) {
|
|
|
- $this->param = [];
|
|
|
|
|
|
|
+ $this->param = [];
|
|
|
|
|
+ $this->mergeParam = false;
|
|
|
return $this->post = array_merge($this->post, $name);
|
|
return $this->post = array_merge($this->post, $name);
|
|
|
}
|
|
}
|
|
|
return $this->input($this->post, $name, $default, $filter);
|
|
return $this->input($this->post, $name, $default, $filter);
|
|
@@ -726,9 +729,9 @@ class Request
|
|
|
/**
|
|
/**
|
|
|
* 设置获取PUT参数
|
|
* 设置获取PUT参数
|
|
|
* @access public
|
|
* @access public
|
|
|
- * @param string|array $name 变量名
|
|
|
|
|
- * @param mixed $default 默认值
|
|
|
|
|
- * @param string|array $filter 过滤方法
|
|
|
|
|
|
|
+ * @param string|array $name 变量名
|
|
|
|
|
+ * @param mixed $default 默认值
|
|
|
|
|
+ * @param string|array $filter 过滤方法
|
|
|
* @return mixed
|
|
* @return mixed
|
|
|
*/
|
|
*/
|
|
|
public function put($name = '', $default = null, $filter = '')
|
|
public function put($name = '', $default = null, $filter = '')
|
|
@@ -743,6 +746,7 @@ class Request
|
|
|
}
|
|
}
|
|
|
if (is_array($name)) {
|
|
if (is_array($name)) {
|
|
|
$this->param = [];
|
|
$this->param = [];
|
|
|
|
|
+ $this->mergeParam = false;
|
|
|
return $this->put = is_null($this->put) ? $name : array_merge($this->put, $name);
|
|
return $this->put = is_null($this->put) ? $name : array_merge($this->put, $name);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -752,9 +756,9 @@ class Request
|
|
|
/**
|
|
/**
|
|
|
* 设置获取DELETE参数
|
|
* 设置获取DELETE参数
|
|
|
* @access public
|
|
* @access public
|
|
|
- * @param string|array $name 变量名
|
|
|
|
|
- * @param mixed $default 默认值
|
|
|
|
|
- * @param string|array $filter 过滤方法
|
|
|
|
|
|
|
+ * @param string|array $name 变量名
|
|
|
|
|
+ * @param mixed $default 默认值
|
|
|
|
|
+ * @param string|array $filter 过滤方法
|
|
|
* @return mixed
|
|
* @return mixed
|
|
|
*/
|
|
*/
|
|
|
public function delete($name = '', $default = null, $filter = '')
|
|
public function delete($name = '', $default = null, $filter = '')
|
|
@@ -765,9 +769,9 @@ class Request
|
|
|
/**
|
|
/**
|
|
|
* 设置获取PATCH参数
|
|
* 设置获取PATCH参数
|
|
|
* @access public
|
|
* @access public
|
|
|
- * @param string|array $name 变量名
|
|
|
|
|
- * @param mixed $default 默认值
|
|
|
|
|
- * @param string|array $filter 过滤方法
|
|
|
|
|
|
|
+ * @param string|array $name 变量名
|
|
|
|
|
+ * @param mixed $default 默认值
|
|
|
|
|
+ * @param string|array $filter 过滤方法
|
|
|
* @return mixed
|
|
* @return mixed
|
|
|
*/
|
|
*/
|
|
|
public function patch($name = '', $default = null, $filter = '')
|
|
public function patch($name = '', $default = null, $filter = '')
|
|
@@ -777,9 +781,9 @@ class Request
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
* 获取request变量
|
|
* 获取request变量
|
|
|
- * @param string $name 数据名称
|
|
|
|
|
- * @param string $default 默认值
|
|
|
|
|
- * @param string|array $filter 过滤方法
|
|
|
|
|
|
|
+ * @param string $name 数据名称
|
|
|
|
|
+ * @param string $default 默认值
|
|
|
|
|
+ * @param string|array $filter 过滤方法
|
|
|
* @return mixed
|
|
* @return mixed
|
|
|
*/
|
|
*/
|
|
|
public function request($name = '', $default = null, $filter = '')
|
|
public function request($name = '', $default = null, $filter = '')
|
|
@@ -788,7 +792,8 @@ class Request
|
|
|
$this->request = $_REQUEST;
|
|
$this->request = $_REQUEST;
|
|
|
}
|
|
}
|
|
|
if (is_array($name)) {
|
|
if (is_array($name)) {
|
|
|
- $this->param = [];
|
|
|
|
|
|
|
+ $this->param = [];
|
|
|
|
|
+ $this->mergeParam = false;
|
|
|
return $this->request = array_merge($this->request, $name);
|
|
return $this->request = array_merge($this->request, $name);
|
|
|
}
|
|
}
|
|
|
return $this->input($this->request, $name, $default, $filter);
|
|
return $this->input($this->request, $name, $default, $filter);
|
|
@@ -797,9 +802,9 @@ class Request
|
|
|
/**
|
|
/**
|
|
|
* 获取session数据
|
|
* 获取session数据
|
|
|
* @access public
|
|
* @access public
|
|
|
- * @param string|array $name 数据名称
|
|
|
|
|
- * @param string $default 默认值
|
|
|
|
|
- * @param string|array $filter 过滤方法
|
|
|
|
|
|
|
+ * @param string|array $name 数据名称
|
|
|
|
|
+ * @param string $default 默认值
|
|
|
|
|
+ * @param string|array $filter 过滤方法
|
|
|
* @return mixed
|
|
* @return mixed
|
|
|
*/
|
|
*/
|
|
|
public function session($name = '', $default = null, $filter = '')
|
|
public function session($name = '', $default = null, $filter = '')
|
|
@@ -816,9 +821,9 @@ class Request
|
|
|
/**
|
|
/**
|
|
|
* 获取cookie参数
|
|
* 获取cookie参数
|
|
|
* @access public
|
|
* @access public
|
|
|
- * @param string|array $name 数据名称
|
|
|
|
|
- * @param string $default 默认值
|
|
|
|
|
- * @param string|array $filter 过滤方法
|
|
|
|
|
|
|
+ * @param string|array $name 数据名称
|
|
|
|
|
+ * @param string $default 默认值
|
|
|
|
|
+ * @param string|array $filter 过滤方法
|
|
|
* @return mixed
|
|
* @return mixed
|
|
|
*/
|
|
*/
|
|
|
public function cookie($name = '', $default = null, $filter = '')
|
|
public function cookie($name = '', $default = null, $filter = '')
|
|
@@ -849,9 +854,9 @@ class Request
|
|
|
/**
|
|
/**
|
|
|
* 获取server参数
|
|
* 获取server参数
|
|
|
* @access public
|
|
* @access public
|
|
|
- * @param string|array $name 数据名称
|
|
|
|
|
- * @param string $default 默认值
|
|
|
|
|
- * @param string|array $filter 过滤方法
|
|
|
|
|
|
|
+ * @param string|array $name 数据名称
|
|
|
|
|
+ * @param string $default 默认值
|
|
|
|
|
+ * @param string|array $filter 过滤方法
|
|
|
* @return mixed
|
|
* @return mixed
|
|
|
*/
|
|
*/
|
|
|
public function server($name = '', $default = null, $filter = '')
|
|
public function server($name = '', $default = null, $filter = '')
|
|
@@ -927,9 +932,9 @@ class Request
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
* 获取环境变量
|
|
* 获取环境变量
|
|
|
- * @param string|array $name 数据名称
|
|
|
|
|
- * @param string $default 默认值
|
|
|
|
|
- * @param string|array $filter 过滤方法
|
|
|
|
|
|
|
+ * @param string|array $name 数据名称
|
|
|
|
|
+ * @param string $default 默认值
|
|
|
|
|
+ * @param string|array $filter 过滤方法
|
|
|
* @return mixed
|
|
* @return mixed
|
|
|
*/
|
|
*/
|
|
|
public function env($name = '', $default = null, $filter = '')
|
|
public function env($name = '', $default = null, $filter = '')
|
|
@@ -946,8 +951,8 @@ class Request
|
|
|
/**
|
|
/**
|
|
|
* 设置或者获取当前的Header
|
|
* 设置或者获取当前的Header
|
|
|
* @access public
|
|
* @access public
|
|
|
- * @param string|array $name header名称
|
|
|
|
|
- * @param string $default 默认值
|
|
|
|
|
|
|
+ * @param string|array $name header名称
|
|
|
|
|
+ * @param string $default 默认值
|
|
|
* @return string
|
|
* @return string
|
|
|
*/
|
|
*/
|
|
|
public function header($name = '', $default = null)
|
|
public function header($name = '', $default = null)
|
|
@@ -985,10 +990,10 @@ class Request
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
* 获取变量 支持过滤和默认值
|
|
* 获取变量 支持过滤和默认值
|
|
|
- * @param array $data 数据源
|
|
|
|
|
- * @param string|false $name 字段名
|
|
|
|
|
- * @param mixed $default 默认值
|
|
|
|
|
- * @param string|array $filter 过滤函数
|
|
|
|
|
|
|
+ * @param array $data 数据源
|
|
|
|
|
+ * @param string|false $name 字段名
|
|
|
|
|
+ * @param mixed $default 默认值
|
|
|
|
|
+ * @param string|array $filter 过滤函数
|
|
|
* @return mixed
|
|
* @return mixed
|
|
|
*/
|
|
*/
|
|
|
public function input($data = [], $name = '', $default = null, $filter = '')
|
|
public function input($data = [], $name = '', $default = null, $filter = '')
|
|
@@ -1069,9 +1074,9 @@ class Request
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
* 递归过滤给定的值
|
|
* 递归过滤给定的值
|
|
|
- * @param mixed $value 键值
|
|
|
|
|
- * @param mixed $key 键名
|
|
|
|
|
- * @param array $filters 过滤方法+默认值
|
|
|
|
|
|
|
+ * @param mixed $value 键值
|
|
|
|
|
+ * @param mixed $key 键名
|
|
|
|
|
+ * @param array $filters 过滤方法+默认值
|
|
|
* @return mixed
|
|
* @return mixed
|
|
|
*/
|
|
*/
|
|
|
private function filterValue(&$value, $key, $filters)
|
|
private function filterValue(&$value, $key, $filters)
|
|
@@ -1156,9 +1161,9 @@ class Request
|
|
|
/**
|
|
/**
|
|
|
* 是否存在某个请求参数
|
|
* 是否存在某个请求参数
|
|
|
* @access public
|
|
* @access public
|
|
|
- * @param string $name 变量名
|
|
|
|
|
- * @param string $type 变量类型
|
|
|
|
|
- * @param bool $checkEmpty 是否检测空值
|
|
|
|
|
|
|
+ * @param string $name 变量名
|
|
|
|
|
+ * @param string $type 变量类型
|
|
|
|
|
+ * @param bool $checkEmpty 是否检测空值
|
|
|
* @return mixed
|
|
* @return mixed
|
|
|
*/
|
|
*/
|
|
|
public function has($name, $type = 'param', $checkEmpty = false)
|
|
public function has($name, $type = 'param', $checkEmpty = false)
|
|
@@ -1182,8 +1187,8 @@ class Request
|
|
|
/**
|
|
/**
|
|
|
* 获取指定的参数
|
|
* 获取指定的参数
|
|
|
* @access public
|
|
* @access public
|
|
|
- * @param string|array $name 变量名
|
|
|
|
|
- * @param string $type 变量类型
|
|
|
|
|
|
|
+ * @param string|array $name 变量名
|
|
|
|
|
+ * @param string $type 变量类型
|
|
|
* @return mixed
|
|
* @return mixed
|
|
|
*/
|
|
*/
|
|
|
public function only($name, $type = 'param')
|
|
public function only($name, $type = 'param')
|
|
@@ -1204,8 +1209,8 @@ class Request
|
|
|
/**
|
|
/**
|
|
|
* 排除指定参数获取
|
|
* 排除指定参数获取
|
|
|
* @access public
|
|
* @access public
|
|
|
- * @param string|array $name 变量名
|
|
|
|
|
- * @param string $type 变量类型
|
|
|
|
|
|
|
+ * @param string|array $name 变量名
|
|
|
|
|
+ * @param string $type 变量类型
|
|
|
* @return mixed
|
|
* @return mixed
|
|
|
*/
|
|
*/
|
|
|
public function except($name, $type = 'param')
|
|
public function except($name, $type = 'param')
|
|
@@ -1247,7 +1252,7 @@ class Request
|
|
|
/**
|
|
/**
|
|
|
* 当前是否Ajax请求
|
|
* 当前是否Ajax请求
|
|
|
* @access public
|
|
* @access public
|
|
|
- * @param bool $ajax true 获取原始ajax请求
|
|
|
|
|
|
|
+ * @param bool $ajax true 获取原始ajax请求
|
|
|
* @return bool
|
|
* @return bool
|
|
|
*/
|
|
*/
|
|
|
public function isAjax($ajax = false)
|
|
public function isAjax($ajax = false)
|
|
@@ -1257,7 +1262,7 @@ class Request
|
|
|
if (true === $ajax) {
|
|
if (true === $ajax) {
|
|
|
return $result;
|
|
return $result;
|
|
|
} else {
|
|
} else {
|
|
|
- $result = $this->param(Config::get('var_ajax')) ? true : $result;
|
|
|
|
|
|
|
+ $result = $this->param(Config::get('var_ajax')) ? true : $result;
|
|
|
$this->mergeParam = false;
|
|
$this->mergeParam = false;
|
|
|
return $result;
|
|
return $result;
|
|
|
}
|
|
}
|
|
@@ -1266,7 +1271,7 @@ class Request
|
|
|
/**
|
|
/**
|
|
|
* 当前是否Pjax请求
|
|
* 当前是否Pjax请求
|
|
|
* @access public
|
|
* @access public
|
|
|
- * @param bool $pjax true 获取原始pjax请求
|
|
|
|
|
|
|
+ * @param bool $pjax true 获取原始pjax请求
|
|
|
* @return bool
|
|
* @return bool
|
|
|
*/
|
|
*/
|
|
|
public function isPjax($pjax = false)
|
|
public function isPjax($pjax = false)
|
|
@@ -1275,7 +1280,7 @@ class Request
|
|
|
if (true === $pjax) {
|
|
if (true === $pjax) {
|
|
|
return $result;
|
|
return $result;
|
|
|
} else {
|
|
} else {
|
|
|
- $result = $this->param(Config::get('var_pjax')) ? true : $result;
|
|
|
|
|
|
|
+ $result = $this->param(Config::get('var_pjax')) ? true : $result;
|
|
|
$this->mergeParam = false;
|
|
$this->mergeParam = false;
|
|
|
return $result;
|
|
return $result;
|
|
|
}
|
|
}
|
|
@@ -1283,13 +1288,13 @@ class Request
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
* 获取客户端IP地址
|
|
* 获取客户端IP地址
|
|
|
- * @param integer $type 返回类型 0 返回IP地址 1 返回IPV4地址数字
|
|
|
|
|
- * @param boolean $adv 是否进行高级模式获取(有可能被伪装)
|
|
|
|
|
|
|
+ * @param integer $type 返回类型 0 返回IP地址 1 返回IPV4地址数字
|
|
|
|
|
+ * @param boolean $adv 是否进行高级模式获取(有可能被伪装)
|
|
|
* @return mixed
|
|
* @return mixed
|
|
|
*/
|
|
*/
|
|
|
public function ip($type = 0, $adv = true)
|
|
public function ip($type = 0, $adv = true)
|
|
|
{
|
|
{
|
|
|
- $type = $type ? 1 : 0;
|
|
|
|
|
|
|
+ $type = $type ? 1 : 0;
|
|
|
static $ip = null;
|
|
static $ip = null;
|
|
|
if (null !== $ip) {
|
|
if (null !== $ip) {
|
|
|
return $ip[$type];
|
|
return $ip[$type];
|
|
@@ -1364,7 +1369,7 @@ class Request
|
|
|
/**
|
|
/**
|
|
|
* 当前请求的host
|
|
* 当前请求的host
|
|
|
* @access public
|
|
* @access public
|
|
|
- * @param bool $strict true 仅仅获取HOST
|
|
|
|
|
|
|
+ * @param bool $strict true 仅仅获取HOST
|
|
|
* @return string
|
|
* @return string
|
|
|
*/
|
|
*/
|
|
|
public function host($strict = false)
|
|
public function host($strict = false)
|
|
@@ -1445,7 +1450,7 @@ class Request
|
|
|
/**
|
|
/**
|
|
|
* 设置或者获取当前请求的调度信息
|
|
* 设置或者获取当前请求的调度信息
|
|
|
* @access public
|
|
* @access public
|
|
|
- * @param array $dispatch 调度信息
|
|
|
|
|
|
|
+ * @param array $dispatch 调度信息
|
|
|
* @return array
|
|
* @return array
|
|
|
*/
|
|
*/
|
|
|
public function dispatch($dispatch = null)
|
|
public function dispatch($dispatch = null)
|
|
@@ -1565,7 +1570,7 @@ class Request
|
|
|
/**
|
|
/**
|
|
|
* 设置当前地址的请求缓存
|
|
* 设置当前地址的请求缓存
|
|
|
* @access public
|
|
* @access public
|
|
|
- * @param string $key 缓存标识,支持变量规则 ,例如 item/:name/:id
|
|
|
|
|
|
|
+ * @param string $key 缓存标识,支持变量规则 ,例如 item/:name/:id
|
|
|
* @param mixed $expire 缓存有效期
|
|
* @param mixed $expire 缓存有效期
|
|
|
* @param array $except 缓存排除
|
|
* @param array $except 缓存排除
|
|
|
* @param string $tag 缓存标签
|
|
* @param string $tag 缓存标签
|
|
@@ -1628,7 +1633,7 @@ class Request
|
|
|
throw new \think\exception\HttpResponseException($response);
|
|
throw new \think\exception\HttpResponseException($response);
|
|
|
} elseif (Cache::has($key)) {
|
|
} elseif (Cache::has($key)) {
|
|
|
list($content, $header) = Cache::get($key);
|
|
list($content, $header) = Cache::get($key);
|
|
|
- $response = Response::create($content)->header($header);
|
|
|
|
|
|
|
+ $response = Response::create($content)->header($header);
|
|
|
throw new \think\exception\HttpResponseException($response);
|
|
throw new \think\exception\HttpResponseException($response);
|
|
|
} else {
|
|
} else {
|
|
|
$this->cache = [$key, $expire, $tag];
|
|
$this->cache = [$key, $expire, $tag];
|
|
@@ -1650,7 +1655,7 @@ class Request
|
|
|
* 设置当前请求绑定的对象实例
|
|
* 设置当前请求绑定的对象实例
|
|
|
* @access public
|
|
* @access public
|
|
|
* @param string|array $name 绑定的对象标识
|
|
* @param string|array $name 绑定的对象标识
|
|
|
- * @param mixed $obj 绑定的对象实例
|
|
|
|
|
|
|
+ * @param mixed $obj 绑定的对象实例
|
|
|
* @return mixed
|
|
* @return mixed
|
|
|
*/
|
|
*/
|
|
|
public function bind($name, $obj = null)
|
|
public function bind($name, $obj = null)
|