$globals Array
function TestFunction () {
echo $globals ["php_self"];
}
TestFunction ();
This program uses global definitions
function TestFunction () {
Global $s;
Echo $s;
}
$s = ' this is www.111cn.net ';
TestFunction ();
Examples of static variables
function TestFunction () {
Static $mystr;
$mystr. = "111cn.net";
echo $mystr. " <br> ";
}
TestFunction (); 111cn.net
TestFunction (); 111cn.net111cn.net
TestFunction (); 111cn.net111cn.net111cn.net
Ordinary variable
function TestFunction () {
$mystr. = "Www.111cn.net";
echo $mystr. " <br> ";
}
TestFunction (); Www.111cn.net
Here's a quick introduction to the Super global variables in PHP that have those
$GLOBALS contains a reference to the global scope valid variable for each current script, instance
$GLOBALS [' site '];
$_server variables are set by the Web server or directly associated with the execution environment of the current script
echo $_server[' Document_root '];
$_get URL Request submit to script variable
echo $_get[' AC ']
$_post HTTP POST Method submit to script variable
echo $_post[' AB ']
$_cookie HTTP Cookie Method submit to script variable
Setcookie (' Load ', ' www.111cn.net ', Time () +3600*24, '/', ' 192.168.0.110 ');
$cookis = $_cookie[' Loaddomain '];
$_files HTTP POST File Upload and submit to script variable
<form name= "Form1" enctype= "Multipart/form-data" method= "POST" action= "" >
<input type= "File" name= "file" >
<input type= "Submit" name= "Submission" value= "submitted" >
</form>
Output value:
Print_r ($_files[' file '));
array
(
[name] => 45457.jpg
[type] = > Image/pjpeg
[tmp_name] => c:windowstempphpd7.tmp
[error] => 0
[size] => 10974
//$_env deprecated
//$_ The REQUEST is submitted by the Get,post and COOKIE mechanisms to the script's variables, so the array is not secure and inefficient.
$_request[' BB '//The data that will be automatically submitted is post,get form