Method code for obtaining client IP_PHP tutorial

WBOY
Release: 2016-07-20 11:05:44
Original
787 people have browsed it

//
//获取客户端IP
//
function GetIP()
{
if(!empty($_SERVER["HTTP_CLIENT_IP"]))
$cip = $_SERVER["HTTP_CLIENT_IP"];
else if(!empty($_SERVER["HTTP_X_FORWARDED_FOR"]))
$cip = $_SERVER["HTTP_X_FORWARDED_FOR"];
else if(!empty($_SERVER["REMOTE_ADDR"]))
$cip = $_SERVER["REMOTE_ADDR"];
else
$cip = "无法获取!";
return $cip;
}


www.bkjia.comtruehttp://www.bkjia.com/PHPjc/445107.htmlTechArticle// //获取客户端IP // function GetIP() { if(!empty($_SERVER[HTTP_CLIENT_IP])) $cip = $_SERVER[HTTP_CLIENT_IP]; else if(!empty($_SERVER[HTTP_X_FORWARDED_FOR])) $cip = $_SERVER[H...
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template