Welcome to the Linux community forum and interact with 2 million technical staff. In php, the difference between getenv () and $ _ SERVER usage: getenv gets the system environment variable. The environment variable format is namevalue. syntax: stringgetenv (stringvarname); Return Value: String function type: PHP system function description if the ring is obtained correctly
Welcome to the Linux community forum and interact with 2 million technical staff> enter the getenv () and $ _ SERVER usage differences in php: getenv gets the system environment variable, the environment variable format is name = value. syntax: string getenv (string varname); Return Value: string function type: PHP system function description if the ring is obtained correctly
Welcome to the Linux community forum and interact with 2 million technicians>
Difference between getenv () and $ _ SERVER in php:
Getenv obtains the system environment variable. The format of the environment variable is name = value.
Syntax: string getenv (string varname );
Return Value: String function type: PHP System Function
Description
If the environment variable varname is obtained correctly, the variable value is returned. If the variable fails, false is returned.
In the following example, you can obtain the URL of the machine where your browser is located.
$ Ip = getenv ("REMOTE_ADDR ");
?>
$ _ SERVER is the Super global variable array of the SERVER. You can use $ _ SERVER ['remote _ ADDR '] to obtain the IP address of the client.
The difference between the two is that getenv does not support php running in IIS isapi Mode