获得客户端ip的范例代码:
unset($onlineip);
if($_SERVER['HTTP_CLIENT_IP']){
$onlineip=$_SERVER['HTTP_CLIENT_IP'];
}elseif($_SERVER['HTTP_X_FORWARDED_FOR']){
$onlineip=$_SERVER['HTTP_X_FORWARDED_FOR'];
}else{
$onlineip=$_SERVER['REMOTE_ADDR'];
}
echo $onlineip;
?>
$onlineip=$_SERVER['REMOTE_ADDR']; //获得客户端ip的系统变量。
阅读(1590) | 评论(0) | 转发(0) |