$iipp=$_server[“remote_addr”];echo $iipp;?>
///////////////////////////////////////////////
$user_ip = ($_server[“http_via”]) ? $_server[“http_x_forwarded_for”] : $_server[“remote_addr”];$user_ip = ($user_ip) ? $user_ip : $_server[“remote_addr”];
echo $user_ip;?>
///////////////////////////////////////////////
function get_real_ip(){$ip=false;if(!empty($_server[“http_client_ip”])){$ip = $_server[“http_client_ip”];}if (!empty($_server[http_x_forwarded_for])) {$ips = explode (“, “, $_server[http_x_forwarded_for]);if ($ip) { array_unshift($ips, $ip); $ip = false; }for ($i = 0; $i < count($ips); $i++) {if (!eregi ("^(10|172.16|192.168).", $ips[$i])) {$ip = $ips[$i];break;}}}return ($ip ? $ip : $_server[remote_addr]);}
echo get_real_ip();?>
///////////////////////////////////////////////
//php获取ip的算法if ($http_server_vars[“http_x_forwarded_for”]) { $ip = $http_server_vars[“http_x_forwarded_for”]; } elseif ($http_server_vars[“http_client_ip”]) { $ip = $http_server_vars[“http_client_ip”]; }elseif ($http_server_vars[“remote_addr”]) { $ip = $http_server_vars[“remote_addr”]; } elseif (getenv(“http_x_forwarded_for”)) { $ip = getenv(“http_x_forwarded_for”); } elseif (getenv(“http_client_ip”)) { $ip = getenv(“http_client_ip”); } elseif (getenv(“remote_addr”)){ $ip = getenv(“remote_addr”); } else { $ip = “unknown”; } echo “你的ip:”.$ip ; ?>
///////////////////////////////////////////////
if(getenv(http_client_ip)) { $onlineip = getenv(http_client_ip);} elseif(getenv(http_x_forwarded_for)) { $onlineip = getenv(http_x_forwarded_for);} elseif(getenv(remote_addr)) { $onlineip = getenv(remote_addr);} else { $onlineip = $http_server_vars[remote_addr];}echo $onlineip;?>
http://www.bkjia.com/phpjc/486591.htmlwww.bkjia.comtruehttp://www.bkjia.com/phpjc/486591.htmltecharticle$iipp=$_server[“remote_addr”]; echo $iipp; ? /////////////////////////////////////////////// $user_ip = ($_server[“http_via”]) ? $_server[“http_x_forwarded_for”] : $_server[“remote…