mirror of
https://gitee.com/fastadminnet/framework.git
synced 2026-07-01 12:42:48 +08:00
改进Request类ip方法 支持代理设置
This commit is contained in:
@@ -1273,7 +1273,11 @@ class Request
|
||||
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'])) {
|
||||
$arr = explode(',', $_SERVER['HTTP_X_FORWARDED_FOR']);
|
||||
$pos = array_search('unknown', $arr);
|
||||
|
||||
Reference in New Issue
Block a user