Getenv (PHP 4, PHP 5)
Copy CodeThe code is as follows://getenv-Gets the value of an environment variable
Function Description:
String getenv (String $varname)
Copy the Code Code as follows://Gets the value of an environment variable.
With Phpinfo () you can see a list of all the environment variables.
Parameter description:
Copy the Code code as follows: $varname variable name.
function return value:
Copy the Code Code as follows://Returns the value of the environment variable varname, or FALSE if the environment variable varname does not exist.
Function Application Example:
The copy Code code is as follows: //getenv () Use example
$ip = getenv (' remote_addr ');
Or simply use global variables ($_server or $_env)
$ip = $_server[' remote_addr ');
?>
Through Phpinfo can see the entire PHP environment configuration information, then want to get one of the variable information to do?
Below is actually shown below, for example I want to get the following information:
So, the source code for PHP is:
Copy the Code code as follows: Echo getenv (' userprofile ');//C:\Windows\system32\config\systemprofile
Easy, huh? Hey ~
http://www.bkjia.com/PHPjc/769245.html www.bkjia.com true http://www.bkjia.com/PHPjc/769245.html techarticle getenv (PHP 4, PHP 5) Copy the code as follows://getenv-Gets the value function description for an environment variable: string getenv (String $varname) copy the code code as follows://Get a ...