Cookie::get()
Get a cookie value
Cookie::get(string|null $key = null, string|null $default = null): string|array|null
Parameters
Name | Type | Default | Description |
---|---|---|---|
$key | string ornull |
null
|
The name of the cookie |
$default | string ornull |
null
|
The default value, which should be returned if the cookie has not been found |
Return types
string
orarray
ornull
The found value
Parent class
Examples
// sample output: 'hello' or if the cookie is not set 'peter'
Cookie::get('mycookie', 'peter');