Home  >  Article  >  Backend Development  >  PHP Tutorial Predefined Variables_PHP Tutorial

PHP Tutorial Predefined Variables_PHP Tutorial

WBOY
WBOYOriginal
2016-07-21 15:43:31760browse

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
?>

www.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...
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn