PHP filter_input(INPUT_SERVER, 'REQUEST_METHOD') returns null?

后端 未结 5 2249
一整个雨季
一整个雨季 2021-01-01 18:20

Why does this line return null in my live server?

filter_input(INPUT_SERVER, \'REQUEST_METHOD\');

The live server is p

5条回答
  •  心在旅途
    2021-01-01 18:36

    I was having the same issue in my XAMPP localhost as well and was looking for solutions madly. What I ended up with, it is a known PHP bug for this function if you are running the PHP in FCGI mode (FCGI/PHP 5.4 in my case). I was confirmed going through this link.

    The workaround I used is to filter_var($_SERVER['PHP_AUTH_USER'], FILTER_SANITIZE_STRING) but this is not an alternative of filter_input. filter_input is more secure.

提交回复
热议问题