Home >php教程 >php手册 >一个得到IP地址的函数

一个得到IP地址的函数

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOriginal
2016-06-21 09:06:591414browse

ip地址|函数

function getip()

{

   if(getenv('HTTP_CLIENT_IP'))

   {

    $onlineip = getenv('HTTP_CLIENT_IP');

   }

   elseif(getenv('REMOTE_ADDR'))

   {

    $onlineip = getenv('REMOTE_ADDR');

   }

   else

   {

    $onlineip = $_SERVER['REMOTE_ADDR'];

   }

   return $onlineip;

}

$ip=getip();

echo $ip;

?>



Statement:
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