简体   繁体   English

请求用户IP地址返回服务器IP地址

[英]Request for user IP adress returns server ip address

When I'm trying to obtain user IP address $_SERVER['REMOTE_ADDR'] it returns me server IP address instead. 当我尝试获取用户IP地址$_SERVER['REMOTE_ADDR']它将返回我服务器IP地址。 I'm using PHP in Apache. 我在Apache中使用PHP。

What problem it could be? 可能是什么问题? I'm using own VPS from digitalocean with LAMP in ubuntu 14.04 我在Ubuntu 14.04中使用来自Digitalocean和LAMP的VPS

Well, I am eating my words now. 好吧,我现在正在吃我的话。

This is interesting. 这是有趣的。

Let try another: 让我们尝试另一个:

<?php
phpinfo(); 
?>

I am stumped, I will think about it. 我很沮丧,我会考虑的。 I have posted my phpinfo and yours. 我已经发布了我的phpinfo和您的。
Yours should also have 99.3.150.55 for _SERVER['REMOTE_ADDR'] 您的_SERVER['REMOTE_ADDR']也应该有99.3.150.55

在此处输入图片说明

在此处输入图片说明

No, I highly doubt what you are saying is true. 不,我非常怀疑您在说什么是真的。 You are overlooking something. 您正在忽略某些东西。

If you are willing to give me a link, put this script on your Server: 如果您愿意给我一个链接,请将此脚本放在服务器上:

I would like to go to that link and see your Servers IP address come up when I visit. 我想转到该链接,并在访问时看到您的服务器IP地址。

<?php
echo $_SERVER['REMOTE_ADDR'] ;  
?>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM