开发者

what exactly is $_REQUEST[$K] in PHP?

开发者 https://www.devze.com 2023-01-15 06:35 出处:网络
$_REQUEST[$k] = isset($_GET[$k]) ? $_GET[$k] : $_POST[$k]; or开发者_JAVA技巧 $_REQUEST[$k] = isset($_POST[$k]) ? $_POST[$k] : $_GET[$k];
$_REQUEST[$k] = isset($_GET[$k]) ? $_GET[$k] : $_POST[$k];

or开发者_JAVA技巧

$_REQUEST[$k] = isset($_POST[$k]) ? $_POST[$k] : $_GET[$k];

Which is the case,reason?


$_REQUEST is the union of $_GET, $_POST, and $_COOKIE where variables_order and since PHP 5.3 request_order defines the order.

The default order is GET, POST, and then cookie. That means POST parameters overwrite existing GET parameters and cookies overwrite existing POST and GET parameters.


ini directive "variables_order" is believed* to affect $_REQUEST, see http://php.net/manual/en/ini.core.php

*"believed" because i never used either that or $_REQUEST itself.


$_REQUEST is simply the array that PHP puts all of the GET and POST and COOKIE parameters into, with precedence in that order in the case of conflicts.

http://php.net/manual/en/reserved.variables.request.php

0

精彩评论

暂无评论...
验证码 换一张
取 消