Home >Backend Development >PHP Tutorial >PHP uses $_SERVER["REMOTE_ADDR"] to obtain the access IP address, _serverremote_addr_PHP tutorial

PHP uses $_SERVER["REMOTE_ADDR"] to obtain the access IP address, _serverremote_addr_PHP tutorial

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOriginal
2016-07-13 09:56:161509browse

php uses $_SERVER["REMOTE_ADDR"] to obtain the access IP address, _serverremote_addr



print "Your IP address is:";


if(!empty($_SERVER["HTTP_CLIENT_IP"])){
$cip = $_SERVER["HTTP_CLIENT_IP"];
}
elseif(!empty($_SERVER[" HTTP_X_FORWARDED_FOR"])){
$cip = $_SERVER["HTTP_X_FORWARDED_FOR"];
}
elseif(!empty($_SERVER["REMOTE_ADDR"])){
$cip = $_SERVER ["REMOTE_ADDR"];
}
else{
$cip = "Unable to obtain!";
}
print $cip;

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/988861.htmlTechArticlephp uses $_SERVER[REMOTE_ADDR] to obtain the access IP address, _serverremote_addr print "Your IP address is:"; if (!empty($_SERVER["HTTP_CLIENT_IP"])){ $cip = $_SERVER["HTTP_CLIENT_IP"]; } e...
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