如何使用superglobals变量显示localhost中的IP地址[复制]

This question already has an answer here:

I want to get the localhost IP address . I am using the php $_SERVER super global:

$_SERVER['REMOTE_ADDR']; I get my IP address and see it is different from my IP address my output like this ::1 my result is right or wrong how can we find it

</div>

That's correct - it's an IPv6 address.

The result whatever you are getting is right..!!!

::1 is the actual ip address.
 It is an Ipv6 address in localhost
 If you use Ipv4 it will give 127.0.0.1 in localhost..