修改RQ、Router注释

This commit is contained in:
TOP糯米 2024-07-18 14:32:45 +08:00
parent f2d8ac626e
commit df45409102
3 changed files with 33 additions and 42 deletions

View File

@ -81,7 +81,7 @@ class Router
/** /**
* 完整控制器名 * 完整控制器名
* @return mixed * @return string
*/ */
public function controllerFullName() public function controllerFullName()
{ {
@ -90,7 +90,7 @@ class Router
/** /**
* 控制器名 * 控制器名
* @return mixed * @return string
*/ */
public function controller() public function controller()
{ {
@ -99,7 +99,7 @@ class Router
/** /**
* 模块名 * 模块名
* @return mixed * @return string
*/ */
public function module() public function module()
{ {
@ -108,7 +108,7 @@ class Router
/** /**
* 方法名 * 方法名
* @return mixed * @return string
*/ */
public function method() public function method()
{ {
@ -117,7 +117,7 @@ class Router
/** /**
* 请求参数 * 请求参数
* @return mixed * @return array
*/ */
public function params() public function params()
{ {

View File

@ -22,9 +22,9 @@ class Request
/** /**
* 当前URI * 当前URI
* @var mixed|null * @var string
*/ */
private $uri = null; private $uri = '';
/** /**
* post、get数据删除的值 * post、get数据删除的值
@ -44,7 +44,7 @@ class Request
/** /**
* 当前请求方式 * 当前请求方式
* @return mixed|string * @return string
*/ */
public function requestMethod() public function requestMethod()
{ {
@ -53,7 +53,7 @@ class Request
/** /**
* 判断请求方式 * 判断请求方式
* @param $method * @param string $method
* @return bool * @return bool
*/ */
public function is($method) public function is($method)
@ -102,7 +102,7 @@ class Request
/** /**
* 当前请求的URI * 当前请求的URI
* @return mixed * @return string
*/ */
public function uri() public function uri()
{ {
@ -111,7 +111,7 @@ class Request
/** /**
* 模块名称 * 模块名称
* @return mixed * @return string
*/ */
public function module() public function module()
{ {
@ -120,7 +120,7 @@ class Request
/** /**
* 控制器完整类名 * 控制器完整类名
* @return mixed * @return string
*/ */
public function controllerFullName() public function controllerFullName()
{ {
@ -129,7 +129,7 @@ class Request
/** /**
* 控制器名称 * 控制器名称
* @return mixed * @return string
*/ */
public function controller() public function controller()
{ {
@ -138,7 +138,7 @@ class Request
/** /**
* 方法名称 * 方法名称
* @return mixed * @return string
*/ */
public function method() public function method()
{ {
@ -147,28 +147,19 @@ class Request
/** /**
* 参数 * 参数
* @return mixed * @return array
*/ */
public function params() public function params()
{ {
return Router::instance($this)->params(); return Router::instance($this)->params();
} }
/**
* 当前加载的路由规则
* @return null
*/
public function routeParameters()
{
return Router::instance($this)->loadRuleParameters();
}
/** /**
* 移除值 * 移除值
* @param $field * @param string $field
* @return $this * @return $this
*/ */
public function except($field = null) public function except($field = '')
{ {
if (is_array($field)) { if (is_array($field)) {
$this->except = array_merge($this->except, $field); $this->except = array_merge($this->except, $field);
@ -221,11 +212,11 @@ class Request
/** /**
* 得到当前的URI * 得到当前的URI
* @return mixed|null * @return string
*/ */
private function getUri() private function getUri()
{ {
$uri = null; $uri = '';
if (isset($this->server['PATH_INFO']) && $this->server['PATH_INFO']) { if (isset($this->server['PATH_INFO']) && $this->server['PATH_INFO']) {
$uri = $this->server['PATH_INFO']; $uri = $this->server['PATH_INFO'];
} elseif (isset($_GET['s']) && $_GET['s']) { } elseif (isset($_GET['s']) && $_GET['s']) {
@ -236,16 +227,16 @@ class Request
/** /**
* GET POST公共方法 * GET POST公共方法
* @param $type * @param string $type
* @param $name * @param string $name
* @param $except * @param array $except
* @param $filter * @param string $filter
* @return null * @return array|string|null
*/ */
private function requestData($type, $name, $except, $filter) private function requestData($type, $name, $except, $filter)
{ {
$data = ($type == 'get') ? $_GET : $_POST; $data = ($type == 'get') ? $_GET : $_POST;
$name = ($name == '*') ? null : $name; $name = ($name == '*') ? '' : $name;
if (!is_array($except)) { if (!is_array($except)) {
$except = explode(',', $except); $except = explode(',', $except);

View File

@ -87,10 +87,10 @@ class Response
/** /**
* 设置Header * 设置Header
* @param null $header * @param array|string $header
* @return $this * @return $this
*/ */
public function header($header = null) public function header($header)
{ {
if (is_array($header)) { if (is_array($header)) {
$this->header = array_merge($this->header, $header); $this->header = array_merge($this->header, $header);
@ -106,7 +106,7 @@ class Response
/** /**
* 设置响应状态码 * 设置响应状态码
* @param $code * @param int $code
* @return Response * @return Response
*/ */
public function code($code = 200) public function code($code = 200)
@ -124,7 +124,7 @@ class Response
/** /**
* 返回内容 * 返回内容
* @param $data * @param mixed $data
* @return Response * @return Response
*/ */
public function send($data = null) public function send($data = null)
@ -151,11 +151,11 @@ class Response
/** /**
* 输出文件 * 输出文件
* @param $filename * @param string $filename
* @param $name * @param string $name
* @return Response * @return Response
*/ */
public function sendFile($filename = null, $name = null) public function sendFile($filename, $name = '')
{ {
if (is_file($filename)) { if (is_file($filename)) {
$name = ($name) ? $name : uniqid() . '.' . substr($filename, strrpos($filename, '.') + 1); $name = ($name) ? $name : uniqid() . '.' . substr($filename, strrpos($filename, '.') + 1);
@ -168,7 +168,7 @@ class Response
/** /**
* 处理数据 * 处理数据
* @param $data * @param mixed $data
* @return false|int|null|string * @return false|int|null|string
*/ */
private function getContent($data) private function getContent($data)