CSDN博客

img westdo

php获得客户端ip地址范例

发表于2004/7/7 12:03:00  8382人阅读

<?php

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;

?> 

0 0

相关博文

我的热门文章

img
取 消
img