Chapter 2 External Variables, environment variables, and expressions of PHP

Source: Internet
Author: User
Chapter 2 External Variables, environment variables, expressions of 3PHP 1. external variables $ _ GET, $ _ POST, $ _ REQUEST $ _ FILES, $ _ COOKIE, $ _ SESSIONprint_r ($ _ GET ); // print all submitted forms with the name attribute value echo $ _ GET ["username"]; echo Chapter 2 2/3 PHP external variables, environment variables, expressions
1. external variables
$ _ GET, $ _ POST, and $ _ REQUEST
$ _ FILES, $ _ COOKIE, and $ _ SESSION

Print_r ($ _ GET); // print all submitted forms that contain the value of the name attribute
Echo $ _ GET ["username"];
Echo $ _ POST ["username"];
Or
Echo $ username; // whether it is post or get, you can directly add the variable name with $
2. environment variables
$ _ SERVER and $ _ ENV
Print_r ($ _ SERVER );
Echo $ _ SERVER ["remote_addr"]; // Obtain the client address
Echo $ _ SERVER ["DOCUMENT_ROOT"]; // working directory
Echo $ _ SERVER ["SCRIPT_FILENAME"]; // Current script name
Print_r ($ _ ENV); // All values are included in phpinfo ().

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.