我写了这段代码
$ips = preg_split("/,/", $_SERVER["HTTP_X_FORWARDED_FOR"]);
$ip = $ips[0];
if ($key === $ip && $val === env('SERVER_ADDR')) {
$addr = env($ip);
if ($addr !== null) {
$val = $addr;
}
}
但我收到以下错误:
<b>Notice</b>: Undefined index: HTTP_X_FORWARDED_FOR