PHP $_SERVER['REMOTE_ADDR'] empty

前端 未结 3 644
渐次进展
渐次进展 2020-12-11 04:09

Somehow $_SERVER[\'REMOTE_ADDR\'] returns an empty string, i have the same code (as part of a script) running on multiple servers and it works everywhere else,

3条回答
  •  忘掉有多难
    2020-12-11 04:49

    if you're behind a proxy server, you can use $_SERVER['HTTP_X_FORWARDED_FOR'] or $_SERVER['HTTP_CLIENT_IP'] instead of $_SERVER['REMOTE_ADDR']. this will depends on how your proxy is configured.

提交回复
热议问题