downloads | documentation | faq | getting help | mailing lists | licenses | wiki | reporting bugs | php.net sites | links | conferences | my php.net

search for in the

$_SESSION> <$_FILES
Last updated: Fri, 24 Jul 2009

view this page in

$_REQUEST

$_REQUESTHTTP Request variables

설명

An associative array that by default contains the contents of $_GET, $_POST 그리고 $_COOKIE.

변경점

버전 설명
5.3.0 Introduced request_order. This directive affects the contents of $_REQUEST.
4.3.0 $_FILES information was removed from $_REQUEST.
4.1.0 Introduced $_REQUEST.

주의

Note: 이는 '자동전역' 변수입니다. 스크립트의 모든 영역에서 사용할 수 있습니다. 함수나 메쏘드 안에서 접근하기 위해서 global $variable;를 할 필요가 없습니다.

Note: When running on the command line , this will not include the argv and argc entries; these are present in the $_SERVER array.

Note: The variables in $_REQUEST are provided to the script via the GET, POST, and COOKIE input mechanisms and therefore could be modified by the remote user and cannot be trusted. The presence and order of variables listed in this array is defined according to the PHP variables_order configuration directive.

참고



add a note add a note User Contributed Notes
$_REQUEST
smjg at iname dot com
13-Aug-2009 07:56
Selecting $_GET or $_POST depending on the request method isn't a general solution, since it's possible for an HTTP request to have both posted content and a query string in the URI.

If you want to allow for this possibility, you can use
<?php
$req
= array_merge($_GET, $_POST);
?>
or vice versa, depending on which you want to be used in the event of a clash between them.
strata_ranger at hotmail dot com
18-Jul-2008 12:04
Don't forget, because $_REQUEST is a different variable than $_GET and $_POST, it is treated as such in PHP -- modifying $_GET or $_POST elements at runtime will not affect the ellements in $_REQUEST, nor vice versa.

e.g:

<?php

$_GET
['foo'] = 'a';
$_POST['bar'] = 'b';
var_dump($_GET); // Element 'foo' is string(1) "a"
var_dump($_POST); // Element 'bar' is string(1) "b"
var_dump($_REQUEST); // Does not contain elements 'foo' or 'bar'

?>

If you want to evaluate $_GET and $_POST variables by a single token without including $_COOKIE in the mix, use  $_SERVER['REQUEST_METHOD'] to identify the method used and set up a switch block accordingly, e.g:

<?php

switch($_SERVER['REQUEST_METHOD'])
{
case
'GET': $the_request = &$_GET; break;
case
'POST': $the_request = &$_POST; break;
.
.
// Etc.
.
default:
}
?>

$_SESSION> <$_FILES
Last updated: Fri, 24 Jul 2009
 
 
show source | credits | stats | sitemap | contact | advertising | mirror sites