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

PHP Tutorial Predefined Variables_PHP Tutorial

WBOY
Release: 2016-07-21 15:43:31
Original
821 people have browsed it

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...
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template