Share the example of using the PHP function getenv. The getenv function is mainly used to obtain the value of an environmental variable. Common PHP probe programs use the getenv function.
Getenv (PHP 4, PHP 5)
// Getenv-get the value of an environment variable
Function Description: www.jbxue.com
String getenv (string $ varname)
// Obtain the value of an environment variable.
// Use phpinfo () to view the list of all environment variables.
Parameter description:
$ Varname variable name.
Function return value:
// Return the value of the environment variable varname. If the environment variable varname does not exist, FALSE is returned.
Function Application Example:
<? Php // getenv () usage example $ ip = getenv ('remote _ ADDR '); // or simply use only global variables ($ _ SERVER or $ _ ENV) $ ip = $ _ SERVER ['remote _ ADDR '];?>
You can see the configuration information of the entire PHP environment through phpinfo. What if you want to get the information of one of the variables?
Obtain the following information:
Php code:
Echo getenv ('userprofile '); // C: \ Windows \ system32 \ config \ systemprofile