doujiu6976
doujiu6976
2018-06-09 05:16
浏览 37
已采纳

为什么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
    duanou9739 2018-06-09 05: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.

    点赞 评论

相关推荐