App::cookie

Usage

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

Description

Retrieve the value of a cookie.

Parameters

Parameter Required Type Description
$key Yes string The name of the cookie.
$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 cookie.

Examples

Get values of some cookies.



if (!$session_id = $app->cookie('session_id')) { throw new Exception("You are not logged in."); } $token = $app->cookie('token');

See Also