problem with $_SERVER['REMOTE_ADDR']

前端 未结 3 2045
情话喂你
情话喂你 2021-01-16 11:56

i used $_SERVER[\'REMOTE_ADDR\'] and it returns client ip address (IP address from which the user is viewing the current page) but at now (and same code) it returns host ip

3条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2021-01-16 12:03

    You should query for HTTP_X_FORWARDED_FOR first and if it isn't assigned use REMOTE_ADDR.

提交回复
热议问题