Home >php教程 >php手册 >PHP教程 预定义变量

PHP教程 预定义变量

WBOY
WBOYOriginal
2016-06-13 12:20:591167browse

这些数组非常特别,它们在全局范围内自动生效,例如,在任何范围内自动生效。因此通常被称为自动全局变量(autoglobals)或者超全局变量(superglobals)。

复制代码 代码如下:


$a = "PHP教程网";
echo "通过\$GLOBALS来取变量值:".$GLOBALS['a'];
//输出:通过$GLOBALS来取变量值:PHP教程网
echo "
";
echo "当前执行脚本的文件名:".$_SERVER['PHP_SELF'];
//输出:当前执行脚本的文件名:/study_php/2-3.php
echo "
";
echo "当前执行脚本所在的根目录:".$_SERVER['DOCUMENT_ROOT'];
//输出:当前执行脚本所在的根目录:H:
echo "
";
echo "当前执行脚本的的绝对路径:".$_SERVER['SCRIPT_FILENAME'];
//输出:当前执行脚本的的绝对路径:H:/study_php/2-3.php
?>

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