Add magic method to native request object

This commit is contained in:
joyqi 2021-09-16 17:05:43 +08:00
parent f6b02ebe24
commit ec495d7e24

View File

@ -168,6 +168,29 @@ class Request
return $value ?? $default;
}
/**
* 获取实际传递参数(magic)
*
* @param string $key 指定参数
* @return mixed
*/
public function __get(string $key)
{
return $this->get($key);
}
/**
* 判断参数是否存在
*
* @param string $key 指定参数
* @return boolean
*/
public function __isset(string $key)
{
$this->get($key, null, $exists);
return $exists;
}
/**
* 获取一个数组
*