Which to use: REMOTE_ADDR or SERVER_ADDR

前端 未结 2 640
我在风中等你
我在风中等你 2021-02-19 03:44

Any real difference between

$_SERVER[\'REMOTE_ADDR\']
$_SERVER[\'SERVER_ADDR\']

I\'m tracking visitors to a page, and I\'ve always used

2条回答
  •  花落未央
    2021-02-19 04:09

    The $_SERVER['REMOTE_ADDR'] returns the IP address from which the user is viewing the current page. And $_SERVER['SERVER_ADDR'] returns the IP address of the server under which the current script is executing.

    So what should you use:

    You should use $_SERVER['REMOTE_ADDR'].

    More Info:

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

提交回复
热议问题