Home  >  Article  >  Backend Development  >  php ip地址解决方案

php ip地址解决方案

WBOY
WBOYOriginal
2016-06-13 12:11:25844browse

php ip地址

<br />global $ip;<br />if (getenv("HTTP_CLIENT_IP"))<br />	$ip = getenv("HTTP_CLIENT_IP");<br />else if(getenv("HTTP_X_FORWARDED_FOR"))<br />	$ip = getenv("HTTP_X_FORWARDED_FOR");<br />else if(getenv("REMOTE_ADDR"))<br />	$ip = getenv("REMOTE_ADDR");<br />else $ip = "Unknow";<br />	return $ip;<br />}<br /> <br />// 使用方法:<br />$ip = getIP();<br />


为什么在一台服务器能正确的获取到ip
另一个台服务器就获取到192.168.1.111
这是什么原因造成的
------解决思路----------------------
另一台服务器你是想说 局域网的吗?

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn