我的IP在PHP家庭服务器中显示错误
好的很简单
<?PHP
echo $_SERVER[REMOTE_ADDR];
?>
好吧也许不是,我的IP目前 72.184.212.85 但是我在一个脚本的IP阻塞系统上使用的代码显示我的IP作为我的家庭服务器IP 127.0.0.1
Ok maybe not, I my IP is currently 72.184.212.85 however the code above which I am using on an IP blocking system for a script shows my IP as my home server IP of 127.0.0.1
所以当我转到我的脚本我的IP显示为 127.0.0.1 ,但当我转到其他网站时,它显示为 72.184.212.85
So when I go to my script my IP is shown as 127.0.0.1 but when I go to other websites it is shown as 72.184.212.85
如何在测试服务器上显示第一个值?
How can I get the first value to show on my test server?
$ _ SERVER ['REMOTE_ADDR']
将始终显示请求所来自的IP地址。如果您在自己的网络中在自己的计算机上访问自己的脚本,则外部IP地址永远不会发挥作用。该请求必须离开您的本地网络,然后返回以显示外部地址,但如果它全部是本地的,则永远不会发生。
$_SERVER['REMOTE_ADDR']
will always show the IP address from which the request came. If you access your own script on your own computer within your own network, your external IP address never comes into play. The request would have to leave your local network and then come back in for the external address to show up, but if it's all local, that'll never happen.