Starting from PHP4.1.0, PHP provides a set of additional pre-defined arrays that contain data from the web server (if available), runtime environment, and user input. These arrays are very special and they take effect globally, for example, automatically within any range. Therefore, it is usually called autoglobals or superglobals ).
The code is as follows:
$ A = "PHP Tutorial Network ";
Echo "get the variable value through \ $ GLOBALS:". $ GLOBALS ['A'];
// Output: Get the variable value through $ GLOBALS: PHP Tutorial network
Echo"
";
Echo "file name of the script being executed:". $ _ SERVER ['php _ SELF '];
// Output: file name of the script being executed:/study_php/2-3.php
Echo"
";
Echo "ROOT directory of the script being executed:". $ _ SERVER ['document _ root'];
// Output: the root directory of the script being executed: H:
Echo"
";
Echo "absolute path of the SCRIPT being executed:". $ _ SERVER ['script _ filename'];
// Output: the absolute path of the script being executed: H:/study_php/2-3.php
?>