PHP $ _SERVER ['REMOTE_HOST']返回:: 1 [英] PHP $_SERVER['REMOTE_HOST'] returns ::1
本文介绍了PHP $ _SERVER ['REMOTE_HOST']返回:: 1的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
Possible Duplicate:
should $ip=$_SERVER['REMOTE_ADDR']; return ::1 on a mamp localhost?
我正在尝试使用PHP获取网站访问者的IP地址.我期望$ _SERVER ['REMOTE_HOST']返回类似127.0.0.1的内容,但它返回的是:: 1.
I am trying to get the IP address of the website visitor in PHP. I'm expecting $_SERVER['REMOTE_HOST'] to return something like 127.0.0.1, but it's returning ::1.
推荐答案
::1 is the IPv6 equivalent of 127.0.0.1 - see http://www.juniper.net/techpubs/software/erx/erx50x/swconfig-routing-vol1/html/ipv6-config5.html The long form of that is
0:0:0:0:0:0:0:1 - but the :: stands in for the run of 0's.
这篇关于PHP $ _SERVER ['REMOTE_HOST']返回:: 1的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文