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

search for in the

$_SESSION> <$_FILES
Last updated: Fri, 22 Aug 2008

view this page in

$_REQUEST

$_REQUESTHTTP Request-Variablen

Beschreibung

Ein assoziatives Array, das standardmäßig den Inhalt von $_GET, $_POST und $_COOKIE enthält.

ChangeLog

Version Beschreibung
5.3.0 request_order eingeführt. Die Direktive wirkt sich auf den Inhalt von $_REQUEST aus.
4.3.0 $_FILES-Informationen aus $_REQUEST entfernt.
4.1.0 $_REQUEST eingeführt.

Anmerkungen

Hinweis: Dies ist eine 'Superglobale' oder automatisch globale Variable. Dies bedeutet das sie innerhalb des Skripts in jedem Geltungsbereich sichtbar ist. Es ist nicht nötig sie mit global $variable bekannt zu machen um aus Funktionen oder Methoden darauf zuzugreifen.

Hinweis: Wenn das Skript auf der Kommandozeile ausgeführt wird, enthält die Variable nicht den Inhalt von argv und argc; diese finden sich im Array $_SERVER.

Hinweis: Variablen, die dem Skript mittels der GET-, POST- und COOKIE-Inputmechanismen zur Verfügung gestellt werden. Der Inhalt ist nicht vertrauenswürdig. Das Vorhandensein und die Reihenfolge des Variableninhalts in diesem Array wird entsprechend der PHP-Konfigurationsdirektive variables_order bestimmt.



$_SESSION> <$_FILES
Last updated: Fri, 22 Aug 2008
 
add a note add a note User Contributed Notes
$_REQUEST
strata_ranger at hotmail dot com
17-Jul-2008 08: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:
}
?>
not at important dot dig
08-Jun-2008 12:39
That would depend on your server configuration.
not at telling dot org
22-May-2008 07:05
POST has priority over GET.

If you POST and GET the same variable with different values, the POST value will be the one used in the REQUEST variable.

EX:
<?PHP
if(isset($_GET['posted']) == 1)
{
    echo
"POST: ";
   
print_R($_POST);
    echo
"<br/>GET: ";
   
print_R($_GET);
    echo
"<br/>REQUEST: ";
   
print_R($_REQUEST);
}
else
{
   
?>
    <form method="post" action="?posted=1&something=someotherval">
        <input type="text" value="someval" name="something"/>
        <input type="submit" value="Click"/>
    </form>
    <?
}
?>

The above form post will result in the following output:

POST: Array ( [something] => someval )
GET: Array ( [posted] => 1 [something] => someotherval )
REQUEST: Array ( [posted] => 1 [something] => someval )

$_SESSION> <$_FILES
Last updated: Fri, 22 Aug 2008
 
 
show source | credits | stats | sitemap | contact | advertising | mirror sites