Pay attention to the usage of $ _ REQUEST in php. When talking about $ _ REQUEST, we all know that it is a collection of $ _ GET and $ _ POST. If you are interested, check the document and you will see: $ _ REQUESTAnassociativearraythatbyde
Problem
Speaking of $ _ REQUEST, we all know that it is a collection of $ _ GET and $ _ POST. But if you are interested, check the document and you will see:
$ _ REQUEST
An associative array that by default contains the contents of $ _ GET, $ _ POST and $ _ COOKIE.
Here, $ _ REQUEST is a set of $ _ GET, $ _ POST, and $ _ cookies by default. as a result, I checked it using my local php and found that only $ _ GET, $ _ POST, no $ _ COOKIE !! Is the document wrong?
Answer
In fact, changelog has explained the following:
For versions later than 5.3, php. ini has the request_order attribute to set $ _ REQUEST. Check php. ini and set request_order to GP (Get and Post ).
Description on the official website of request_order:
Request_order string
This directive describes the order in which PHP registers GET, POST and Cookie variables into the _ REQUEST array. Registration is done from left to right, newer values override older values.
If this directive is not set, variables_order is used for $ _ REQUEST contents.
Note that the default distribution php. ini files does not contain the 'C' for cookies, due to security concerns.
The original versions are G, P, and C, which respectively represent Get, Post, Cookie, and request_order of versions later than 5.3 are set to GP by default and do not contain C, that is, $ _ REQUEST only includes $ _ GET and $ _ POST by default !! (Therefore, the official website documents are misleading ).
Also, the order of G, P, and C is the overwrite sequence of the set array.
Note: If you are using the fpm-php experiment, you need to restart php-fpm after modifying php. ini.
Starting with $ _ REQUEST, we all know that it is a collection of $ _ GET and $ _ POST. But if you are interested, check the document and you will see: $ _ REQUEST An associative array that by de...