These arrays are very special in that they are automatically valid globally, i.e. automatically in any scope. Therefore they are often called autoglobals or superglobals.
Copy code 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 "The file name of the currently executing script: ".$_SERVER['PHP_SELF'];
//Output: The file name of the currently executing script:/study_php/2-3.php
echo "
";
echo "The root directory where the currently executing script is located:".$_SERVER['DOCUMENT_ROOT'];
//Output: The root directory where the currently executing script is located: H:
echo "
";
echo "The absolute path of the currently executing script: ".$_SERVER['SCRIPT_FILENAME'];
//Output: The absolute path of the currently executing script: H:/study_php/2-3.php
?>
http://www.bkjia.com/PHPjc/320756.htmlwww.bkjia.comtruehttp: //www.bkjia.com/PHPjc/320756.htmlTechArticleThese arrays are very special, they automatically take effect in the global scope, for example, in any scope. Therefore, they are often called autoglobals or superglobal variables...