mirror of
https://gitee.com/fastadminnet/framework.git
synced 2026-07-07 23:22:48 +08:00
改进Request类ip方法 支持代理设置
This commit is contained in:
@@ -1273,7 +1273,11 @@ class Request
|
|||||||
return $ip[$type];
|
return $ip[$type];
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($adv) {
|
$httpAgentIp = Config::get('http_agent_ip');
|
||||||
|
|
||||||
|
if ($httpAgentIp && isset($_SERVER[$httpAgentIp])) {
|
||||||
|
$ip = $_SERVER[$httpAgentIp];
|
||||||
|
} elseif ($adv) {
|
||||||
if (isset($_SERVER['HTTP_X_FORWARDED_FOR'])) {
|
if (isset($_SERVER['HTTP_X_FORWARDED_FOR'])) {
|
||||||
$arr = explode(',', $_SERVER['HTTP_X_FORWARDED_FOR']);
|
$arr = explode(',', $_SERVER['HTTP_X_FORWARDED_FOR']);
|
||||||
$pos = array_search('unknown', $arr);
|
$pos = array_search('unknown', $arr);
|
||||||
|
|||||||
Reference in New Issue
Block a user