我的IP在PHP家庭服务器中显示错误 [英] My IP is showing up wrong in PHP home server

查看:94
本文介绍了我的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.

这篇关于我的IP在PHP家庭服务器中显示错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆