Difference between REMOTE_HOST and REMOTE_ADDR

亡梦爱人 提交于 2019-11-26 22:59:53

问题


What is the difference between these two variables?

REMOTE_HOST and REMOTE_ADDR.


回答1:


REMOTE_HOST pertains to the hostname of the client (i.e. the computer making the request). REMOTE_ADDR refers to the IP address of the client.

There would be times when the hostname is unresolvable so the REMOTE_HOST will return the REMOTE_ADDR or the IP address instead.




回答2:


1. $_SERVER['REMOTE_ADDR'] - This contains the real IP address of the client. That is the most reliable value you can find from the user.

2. $_SERVER['REMOTE_HOST'] - This will fetch the Host name from which the user is viewing the current page. But for this script to work, Hostname Lookups On inside httpd.conf must be configured.




回答3:


Remote: is a computer that resides in some distant location from which data retrieved it typically refer to a server in a private network or the public internet.

Remote_ host will return the REMOTE_ ADDR Or the IP address instead .



来源:https://stackoverflow.com/questions/3812166/difference-between-remote-host-and-remote-addr

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!