Board logo

标题: PHP获取客户端ip [打印本页]

作者: xiexie    时间: 2008-10-22 22:55     标题: PHP获取客户端ip

function get_client_ip() { if(getenv('HTTP_CLIENT_IP')) { $client_ip = getenv('HTTP_CLIENT_IP'); } elseif(getenv('HTTP_X_FORWARDED_FOR')) { $client_ip = getenv('HTTP_X_FORWARDED_FOR'); } elseif(getenv('REMOTE_ADDR')) { $client_ip = getenv('REMOTE_ADDR'); } else { $client_ip = $HTTP_SERVER_VAR['REMOTE_ADDR']; } return $client_ip; }




欢迎光临 PHP开发笔记 (http://phpvi.com/) Powered by Discuz! 6.1.0