Home > php教程 > php手册 > body text

PHP教程 预定义变量

WBOY
Release: 2016-06-13 12:20:59
Original
1113 people have browsed it

这些数组非常特别,它们在全局范围内自动生效,例如,在任何范围内自动生效。因此通常被称为自动全局变量(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
?>

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 Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!