Analysis of PHP global variable $_request

Source: Internet
Author: User

The $_request variable in PHP refers to the HTTP REQUEST variable.

What values are included in the $_request variable, depending on the request_order settings in the php.ini, the environment I am testing is PHP 5.5.12 and PHP 5.6.9, where the Request_order settings are:

Request_order = "GP"

G represents $_GET,P Representative $_post

In addition to $_get and $_post, you can also add C ($_cookie)

When request_order = "GP", PHP first queries the get variable and then queries the post variable, that is, the value of the post variable overrides the value of the get variable if the request variable for get and the name of the request variable for the post are the same.

example, set the value of Request_order in php.ini to "GPC", that is, if a variable with the same name occurs, the value of the variable in the Cookie overrides the value of the variable with the same name in the Get and POST request:

Visit http://127.0.0.3/php/phpcookbook/form/$_request.php? Name=dee&age=28

<? PHP Setcookie (' name ', ' Emperor '); Echo ' <pre> '; Print_r ($_request);

Output:

Array (    = Emperor    =)

Analysis of PHP global variable $_request

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.