Is $_SERVER['REMOTE_ADDR'] always isset()?

后端 未结 3 1494
你的背包
你的背包 2020-12-20 12:23

I want to store ip2logn($_SERVER[\'REMOTE_ADDR\']) values in the db for some reason.

Practically, as I see, $_SERVER[\'REMOTE_ADDR\'] alwa

3条回答
  •  孤城傲影
    2020-12-20 13:10

    It will only be set if you're running the script through a webserver. If you're running PHP in CLI (command line) mode, REMOTE_ADDR will not be set, as there is no remote address for a command line script.

提交回复
热议问题