The relationship and difference between $_request, $_get, $_post and $_cookie _request, $_get, $_post, $_cookie relations and differences. 1. Relationship: $_request contains all the contents of $_get, $_post, $_cookie, and is their aggregate. 2.$_get, $_post, $_cookie have a copy in $_request. Changing the value of $_request does not affect $_get, and vice versa. 3.GET and Post have the same name, $_request takes the value of the post. In the case of a cookie with the same name as Get or post, $_request takes the value of the cookie. Cookies have the highest precedence. Error。
6.7.2010 Update: PHP. INI is very clear, Variables_order = "GPCs", This order of precedence can be changed.
Oh, my gosh, I'm too low.
The test begins.
Test 1: <code> Echo ' <pre> '//source format printing URL plus m=xxoo&url=www.jzread.com to test $_get
Print_r ($_request)/print First
Print_r ($_get);
$_request = Array ();//Empty $_request
echo $_get[' m ']; Echo ' </pre> '; </code> Test Result: The value of $_get[' m ' is aardvark.
Test 2: <code> Echo ' <pre> '//source format printing URL plus m=xxoo to test $_get
Print_r ($_request);
Print_r ($_get);
$_get = Array ();
Print_r ($_request); Echo ' </pre> '; </code> Test Result: The value of $_request[' m ' is aardvark.
Conclusion: The operation of $_request does not affect $_get, and vice versa. $_request just contains a copy of the $_get (the Mahouve as $_post haha).
------------------------------------Gorgeous divider line www.jzread.com:)--------------------------------------------------- Good. Go on Test 3 <code> Post-get Duplicate name Test Send a value of M from another page post to post,action address plus m=get
Print_r ($_request);
Print_r ($_get);
Print_r ($_post); </code> Result: $_request[' m '] = = ' post '. Conclusion: Both the Get and post are submitted with the same name, and $_request takes the value of the post. (The post priority may be higher.) )
Test 4 <code> Cookie and Postget Duplicate test Setcookie (' m ', ' Cookie ', Time () +3600);//First the cookie is planted, the name is M, and the value is cookie. and then refresh. (Cookies will not take effect until they are refreshed)
Send a value of M from another page post to post,action address plus m=get Print_r ($_request); </code> Result: $_request[' m '] = = ' Cookie '. Conclusion: Cookies have the highest priority.
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.