0

我想在 $_SERVER['REMOTE_ADDR'] 时获得价值 127.0.0.1。而是得到 127.0.0.1。我得到价值::1。任何人都可以帮助我如何获得该价值?将其用于日志活动。

4

1 回答 1

3

::1 is an IPv6 address and an abbreviation for 0:0:0:0:0:0:0:1 that is the loopback address to the local machine. So ::1 is the same as 127.0.0.1 only via IPv6 instead of IPv4.

If you really just want IPv4, try to disable IPv6 connections in your apache configuration:

Listen 0.0.0.0:80
Listen 192.170.2.1:80

You can find detailed solution here

于 2013-04-25T05:30:57.090 回答