I have a PHP script that shows some server variables, the code is as following :
<?php
$FILTEREDHOST = filter_input(INPUT_SERVER,'HTTP_HOST');
$FILTEREDSELF = filter_input(INPUT_SERVER,'PHP_SELF');
$SERVERHOST = $_SERVER['HTTP_HOST'];
$SERVERSELF = $_SERVER['PHP_SELF'];
var_dump($FILTEREDHOST);
echo "</br>";
var_dump($FILTEREDSELF);
echo "</br>";
var_dump($SERVERHOST);
echo "</br>";
var_dump($SERVERSELF);
The result I get is :
NULL
string(9) "/test.php"
string(17) "www.mysite.com"
string(9) "/test.php"
Why $FILTEREDHOST
is returning NULL
?
My PHP version is 5.5.16
HTTP_HOST is not set if the browser didn't send it.
'HTTP_HOST' Contents of the Host: header from the current request, if there is one.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.