doujiu6976 2018-06-08 21:16
浏览 46
已采纳

为什么php官方文档php.net上没有关于$ _SERVER [HTTP_CLIENT_IP]的文档?

Why is there no documentation for $_SERVER[ HTTP_CLIENT_IP ] in php on official documentation php.net?

It seems like there have not have any kind documentation about $_SERVER[ HTTP_CLIENT_IP ] in the internet. Not even reference website such as tutorialpoint or w3school have information about this.

php.net: http://php.net/manual/en/reserved.variables.server.php

tutorial point: https://www.tutorialspoint.com/php/php_predefined_variables.htm

w3school: https://www.w3schools.com/php/php_superglobals.asp

Yet, there are many comments or tutorials in forums uses $_SERVER[ HTTP_CLIENT_IP ] to get a more accurate visitor's IP address. Such as:

stackoverflow questions:Will the value of a set $_SERVER['HTTP_CLIENT_IP'] be an empty string?

information stack exchange: https://security.stackexchange.com/questions/129662/best-approach-to-get-users-ip/129664#129664

Also, there are mention about this in the user contributed notes in php.net, but nothing official

So, is $_SERVER[ HTTP_CLIENT_IP ] actually a real thing as official documentation does not have information about this?

Can $_SERVER[ HTTP_CLIENT_IP ] actually get the "real" IP address of the visitor in a shared network? Thank You

  • 写回答

1条回答 默认 最新

  • duanou9739 2018-06-08 21:23
    关注

    The entries in this array are created by the web server. There is no guarantee that every web server will provide any of these; servers may omit some, or provide others not listed here. That said, a large number of these variables are accounted for in the » CGI/1.1 specification, so you should be able to expect those.

    From http://php.net/manual/en/reserved.variables.server.php

    HTTP_CLIENT_IP is not in CGI/1.1 specification and this name generates by web server. Because of this HTTP_CLIENT_IP may not be in docs.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
编辑
预览

报告相同问题?

手机看
程序员都在用的中文IT技术交流社区

程序员都在用的中文IT技术交流社区

专业的中文 IT 技术社区,与千万技术人共成长

专业的中文 IT 技术社区,与千万技术人共成长

关注【CSDN】视频号,行业资讯、技术分享精彩不断,直播好礼送不停!

关注【CSDN】视频号,行业资讯、技术分享精彩不断,直播好礼送不停!

客服 返回
顶部