PHP Tutorial pre-defined variables

Source: Internet
Author: User
Starting from PHP4.1.0, PHP provides a set of additional pre-defined arrays that contain data from the web server (if available), runtime environment, and user input. These arrays are very special and they take effect globally, for example, automatically within any range. Therefore, it is usually called autoglobals or superglobals ).

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 "file name of the script being executed:". $ _ SERVER ['php _ SELF '];
// Output: file name of the script being executed:/study_php/2-3.php
Echo"
";
Echo "ROOT directory of the script being executed:". $ _ SERVER ['document _ root'];
// Output: the root directory of the script being executed: H:
Echo"
";
Echo "absolute path of the SCRIPT being executed:". $ _ SERVER ['script _ filename'];
// Output: the absolute path of the script being executed: H:/study_php/2-3.php
?>

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.