fix getip()

This commit is contained in:
xiaomlove
2024-03-01 23:45:13 +08:00
parent 7b70ea9079
commit e653fdac6d
3 changed files with 5 additions and 4 deletions

View File

@@ -67,7 +67,8 @@ function getip($real = true) {
$ip = getenv('REMOTE_ADDR') ?? '';
}
}
if ($real) {
$ip = trim(trim($ip), ",");
if ($real && str_contains($ip, ",")) {
return strstr($ip, ",", true);
}
return $ip;