首页  >  文章  >  后端开发  >  获取客户端IP的方法代码_PHP教程

获取客户端IP的方法代码_PHP教程

WBOY
WBOY原创
2016-07-20 11:05:44791浏览

//
//获取客户端IP
//
function GetIP()
{
if(!empty($_SERVER["HTTP_CLIENT_IP"]))
$cip = $_SERVER["HTTP_CLIENT_IP"];
else if(!empty($_SERVER["HTTP_X_FORWARDED_FOR"]))
$cip = $_SERVER["HTTP_X_FORWARDED_FOR"];
else if(!empty($_SERVER["REMOTE_ADDR"]))
$cip = $_SERVER["REMOTE_ADDR"];
else
$cip = "无法获取!";
return $cip;
}


www.bkjia.comtruehttp://www.bkjia.com/PHPjc/445107.htmlTechArticle// //获取客户端IP // function GetIP() { if(!empty($_SERVER[HTTP_CLIENT_IP])) $cip = $_SERVER[HTTP_CLIENT_IP]; else if(!empty($_SERVER[HTTP_X_FORWARDED_FOR])) $cip = $_SERVER[H...
声明:
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn