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 | stringornull |
null
|
The name of the cookie |
| $default | stringornull |
null
|
The default value, which should be returned if the cookie has not been found |
Return types
stringorarrayornull
The found value
Parent class
Examples
// sample output: 'hello' or if the cookie is not set 'peter'
Cookie::get('mycookie', 'peter');