/ Published in: PHP
获取用户真实的IP
Expand |
Embed | Plain Text
function get_client_ip() { if ($realip !== NULL) { return $realip; } { { foreach ($arr AS $ip) { if ($ip != 'unknown') { $realip = $ip; break; } } } { $realip = $_SERVER['HTTP_CLIENT_IP']; } else { { $realip = $_SERVER['REMOTE_ADDR']; } else { $realip = '0.0.0.0'; } } } else { { } { } else { } } return $realip; }
Comments
Subscribe to comments
You need to login to post a comment.

Why it's in Other category rather than PHP? (http://snipplr.com/all/language/php)