- ⌂ request
- Methods
request::cookie()
Access HTTP (or HTTPS) cookie. A cookie may be created with
in response to a previous request to store state information.set_cookie()
Prototype
string cookie(string $key = NULL, boolean $xss_filter = FALSE)
Parameters
- $key - Name of the cookie to retrieve. If NULL or no key is provided, an associative array of all transmitted cookies will be returned.
- $xss_filter - Optional parameter to enable the cross site scripting filter when available, which converts potentially malicious HTML tags into HTML entities.
Return
If the cookie exists, the value is returned as a string, including an empty string. Otherwise, FALSE is returned.
Example
// retrieve the value of the "session_id" cookie parameter
// previously set with set_cookie('session_id',$value);
$request = new \io_comand_web\request();
$search = $request->cookie('session_id');