php: getting ip address

前端 未结 3 1626
伪装坚强ぢ
伪装坚强ぢ 2021-01-20 14:57

I want to get an ip address of visitors. could you tell me what element of $_SERVER[] i should use?

$_SERVER[\'HTTP_CLIENT_IP\'];
$_SERVER[\'HTT         


        
3条回答
  •  温柔的废话
    2021-01-20 15:42

    It depends on if your application is behind a reverse proxy or something like that. The easiest thing to do is check all three and choose the one that is not one of your IPs.

提交回复
热议问题