php $ _SERVER ['REMOTE_ADDR']在Windows 7上无法正常工作

I have a problem and this only happens on my PC (windows 7 64bits), if I echo the following:

echo $_SERVER['REMOTE_ADDR'];

I get : ::1

same thing if i insert in database.

????

::1 is equivalent to 127.0.0.1 in IPv6. That address is equal to localhost, as well, if your hosts file was not altered.

Easily ::1 is indeed the result of localhost, but if u use this if else u could fake your localhost:

$ip = $_SERVER['REMOTE_ADDR'];

                if($ip == '::1')
                    {
                        echo '127.0.0.1';
                    }
                else
                    {
                        echo $ip;
                    }