1、bug的修复
2、内核更新
This commit is contained in:
@@ -62,7 +62,7 @@ class Request
|
||||
/**
|
||||
* @var array 当前路由信息
|
||||
*/
|
||||
protected $route = [];
|
||||
protected $routeInfo = [];
|
||||
|
||||
/**
|
||||
* @var array 当前调度信息
|
||||
@@ -81,6 +81,7 @@ class Request
|
||||
protected $get = [];
|
||||
protected $post = [];
|
||||
protected $request = [];
|
||||
protected $route = [];
|
||||
protected $put;
|
||||
protected $delete;
|
||||
protected $session = [];
|
||||
@@ -608,21 +609,37 @@ class Request
|
||||
// 自动获取请求变量
|
||||
switch ($method) {
|
||||
case 'POST':
|
||||
$vars = $this->post();
|
||||
$vars = $this->post(false);
|
||||
break;
|
||||
case 'PUT':
|
||||
$vars = $this->put();
|
||||
$vars = $this->put(false);
|
||||
break;
|
||||
case 'DELETE':
|
||||
$vars = $this->delete();
|
||||
$vars = $this->delete(false);
|
||||
break;
|
||||
default:
|
||||
$vars = [];
|
||||
}
|
||||
// 当前请求参数和URL地址中的参数合并
|
||||
$this->param = array_merge($this->get(), $vars);
|
||||
$this->param = array_merge($this->route(false), $this->get(false), $vars);
|
||||
}
|
||||
return $this->input($this->param, $name, $default, $filter);
|
||||
return false === $name ? $this->param : $this->input($this->param, $name, $default, $filter);
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置获取获取路由参数
|
||||
* @access public
|
||||
* @param string|array $name 变量名
|
||||
* @param mixed $default 默认值
|
||||
* @param string|array $filter 过滤方法
|
||||
* @return mixed
|
||||
*/
|
||||
public function route($name = '', $default = null, $filter = null)
|
||||
{
|
||||
if (is_array($name)) {
|
||||
return $this->route = array_merge($this->route, $name);
|
||||
}
|
||||
return false === $name ? $this->route : $this->input($this->route, $name, $default, $filter);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -640,7 +657,7 @@ class Request
|
||||
} elseif (empty($this->get)) {
|
||||
$this->get = $_GET;
|
||||
}
|
||||
return $this->input($this->get, $name, $default, $filter);
|
||||
return false === $name ? $this->get : $this->input($this->get, $name, $default, $filter);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -658,7 +675,7 @@ class Request
|
||||
} elseif (empty($this->post)) {
|
||||
$this->post = $_POST;
|
||||
}
|
||||
return $this->input($this->post, $name, $default, $filter);
|
||||
return false === $name ? $this->post : $this->input($this->post, $name, $default, $filter);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -677,7 +694,7 @@ class Request
|
||||
if (is_null($this->put)) {
|
||||
parse_str(file_get_contents('php://input'), $this->put);
|
||||
}
|
||||
return $this->input($this->put, $name, $default, $filter);
|
||||
return false === $name ? $this->put : $this->input($this->put, $name, $default, $filter);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -696,7 +713,7 @@ class Request
|
||||
if (is_null($this->delete)) {
|
||||
parse_str(file_get_contents('php://input'), $this->delete);
|
||||
}
|
||||
return $this->input($this->delete, $name, $default, $filter);
|
||||
return false === $name ? $this->delete : $this->input($this->delete, $name, $default, $filter);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -713,7 +730,7 @@ class Request
|
||||
} elseif (empty($this->request)) {
|
||||
$this->request = $_REQUEST;
|
||||
}
|
||||
return $this->input($this->request ?: $_REQUEST, $name, $default, $filter);
|
||||
return false === $name ? $this->request : $this->input($this->request ?: $_REQUEST, $name, $default, $filter);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -731,7 +748,7 @@ class Request
|
||||
} elseif (empty($this->session)) {
|
||||
$this->session = Session::get();
|
||||
}
|
||||
return $this->input($this->session, $name, $default, $filter);
|
||||
return false === $name ? $this->session : $this->input($this->session, $name, $default, $filter);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -749,7 +766,7 @@ class Request
|
||||
} elseif (empty($this->cookie)) {
|
||||
$this->cookie = $_COOKIE;
|
||||
}
|
||||
return $this->input($this->cookie, $name, $default, $filter);
|
||||
return false === $name ? $this->cookie : $this->input($this->cookie, $name, $default, $filter);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -767,7 +784,7 @@ class Request
|
||||
} elseif (empty($this->server)) {
|
||||
$this->server = $_SERVER;
|
||||
}
|
||||
return $this->input($this->server, $name, $default, $filter);
|
||||
return false === $name ? $this->server : $this->input($this->server, $name, $default, $filter);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -844,7 +861,7 @@ class Request
|
||||
} elseif (empty($this->env)) {
|
||||
$this->env = $_ENV;
|
||||
}
|
||||
return $this->input($this->env, strtoupper($name), $default, $filter);
|
||||
return false === $name ? $this->env : $this->input($this->env, strtoupper($name), $default, $filter);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -882,25 +899,6 @@ class Request
|
||||
return isset($this->header[$name]) ? $this->header[$name] : $default;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取PATH_INFO
|
||||
* @param string $name 数据名称
|
||||
* @param string $default 默认值
|
||||
* @param string|array $filter 过滤方法
|
||||
* @return mixed
|
||||
*/
|
||||
public function pathParam($name = '', $default = null, $filter = null)
|
||||
{
|
||||
$pathinfo = $this->pathinfo();
|
||||
if (!empty($pathinfo)) {
|
||||
$depr = Config::get('pathinfo_depr');
|
||||
$input = explode($depr, trim($pathinfo, $depr));
|
||||
return $this->input($input, $name, $default, $filter);
|
||||
} else {
|
||||
return $default;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取变量 支持过滤和默认值
|
||||
* @param array $data 数据源
|
||||
@@ -1279,17 +1277,17 @@ class Request
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取当前请求的路由
|
||||
* 获取当前请求的路由信息
|
||||
* @access public
|
||||
* @param array $route 路由名称
|
||||
* @return array
|
||||
*/
|
||||
public function route($route = [])
|
||||
public function routeInfo($route = [])
|
||||
{
|
||||
if (!empty($route)) {
|
||||
$this->route = $route;
|
||||
$this->routeInfo = $route;
|
||||
} else {
|
||||
return $this->route;
|
||||
return $this->routeInfo;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user