本篇文章介绍的内容是php获取来访者的真实ip ,现在分享给大家,有需要的朋友可以看一下
/**
* 获取来访者的真实ip
*
*/
function getrealip() {
static $realip = null;
if($realip !== null) {
return $realip;
}
if(getenv('remote_addr')) {
$realip = getenv('remote_addr');
} else if(getenv('http_client_ip')) {
$realip = getenv('http_client_ip');
} else if (getenv('http_x_froward_for')) {
$realip = getenv('http_x_froward_for');
}
return $realip;
}
相关推荐:
004-php图片上传实例
003 - ci在你的类库中使用 codeigniter 资源
以上就是005-php获取来访者的真实ip 的详细内容。
