mirror of
https://github.com/typecho/typecho.git
synced 2025-04-21 18:21:53 +02:00
Add magic method to native request object
This commit is contained in:
parent
f6b02ebe24
commit
ec495d7e24
@ -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;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取一个数组
|
||||
*
|
||||
|
Loading…
x
Reference in New Issue
Block a user