The usage differences between getenv () and $_server in PHP:
GETENV obtains the environment variable of the system, the format of the environment variable is name=value.
Syntax: string getenv (string varname);
Return value: String function type: PHP system function
Content Description
If the environment variable varname is correctly obtained, the value of the variable is returned, and the failure returns false.
The following example can get the URL of the machine where the user's browser
12345 |
<?php $ip = getenv (“REMOTE_ADDR”); ?> |
$_server is the server Super global variable array with $_server[' REMOTE_ADDR ') can also obtain the IP address of the client.
The difference is that getenv does not support PHP, which is run by the ISAPI mode of IIS.
"Go" solves the difference between PHP not getting the IP address ' function getenv ("REMOTE_ADDR") and $_server[' REMOTE_ADDR ']
The difference between getenv () and $_server in PHP