============================================ Get client ip==============================================
Span style= "COLOR: #003300" >public static function Getclientip () {
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 ')) {
$CL IENT_IP = getenv (' remote_addr ');
} else {
$client _ip = $_server[' REMOTE _addr '];
"
return $client _ip;
}
============================================ Get service-side ip==============================================
public static function Getserverip () {
if (Isset ($_server)) {
if ($_server[' server_addr ']) {
$server _ip = $_server[' server_addr ');
} else {
$server _ip = $_server[' local_addr ');
}
} else {
$server _ip = getenv (' server_addr ');
}
return $server _ip;
}
PHP Gets the client IP address, the server IP address