PHP filter_input(INPUT_SERVER,'REQUEST_METHOD') 返回 null?
2022-08-30 20:36:06
为什么此行会返回到我的实时服务器中?null
filter_input(INPUT_SERVER, 'REQUEST_METHOD');
实时服务器是 php5.5.9
我错过了什么吗?
我以为它是用来替换下面的全局方法的吗?
$_SERVER['REQUEST_METHOD'];
一些代码,
public function __construct()
{
// Construct other generic data.
$this->clientRequestMethod = filter_input(INPUT_GET, 'method'); // such as list, add, update, etc
$this->clientPostMethod = filter_input(INPUT_POST, 'method'); // such as update
$this->serverRequestMethod = filter_input(INPUT_SERVER, 'REQUEST_METHOD'); //such as get or post
}
public function processEntry()
{
// Determine the $_SERVER['REQUEST_METHOD'] whether it is post or get.
if ($this->serverRequestMethod === 'POST' && $this->clientPostMethod != null)
{
$this->processPost();
}
else if($this->serverRequestMethod === 'GET' && $this->clientRequestMethod != null)
{
$this->processRequest();
}
}