Gets a previously set cookie-variable's value.



Syntax

getCookie(string $name): ?string

  • $name
    The name of the cookie.


Return

Returns the single cookie's value. Looked up in PHP's global $_COOKIE variable. If this cookie-name does not exist, NULL is returned.


Example

Simply set a cookie variable "myVar":

# On a previous call set a cookie, e.g. like:
{% do hublify.setCookie('myVar', 'Hello World!') %}

# ... and get it later, like: 
{% set val = hublify.getCookie('myVar') %}