doujiu6976 2018-06-09 05: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-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.

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

报告相同问题?

悬赏问题

  • ¥15 stata安慰剂检验作图但是真实值不出现在图上
  • ¥15 c程序不知道为什么得不到结果
  • ¥40 复杂的限制性的商函数处理
  • ¥15 程序不包含适用于入口点的静态Main方法
  • ¥15 素材场景中光线烘焙后灯光失效
  • ¥15 请教一下各位,为什么我这个没有实现模拟点击
  • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
  • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题