App::request

Usage

mixed App::request(string $key, [?stsring $default = null], [string $filters = 'escape'])

Description

Retrieve a variable contained within either the POSTed form fields or query string.

Parameters

Parameter Required Type Description
$key Yes string The name of the of the variable to retrieve.
$default No ?string The value to return if the key does not exist within the query string. Defaults to null.
$filters No string "Period delimited string of words that denote the filters to apply before returning the value. See the Request Inputs page for available filters.

Return Value

The value of the variable from either the $_POST or $_GET super globals.

Examples

Get values of some variables.



if (!$id = $app->request('product_id')) { throw new Exception("No product ID specified."); } $quantity = $app->request('quantity', '1');

See Also