Cookie Helper
The Cookie Helper record contains capacities that help with working with treats.
- Loading this Helper
- Available Functions
Loading this Helper
This assistant is stacked utilizing the accompanying code:
helper('cookie');
Available Functions
The accompanying capacities are accessible:
set_cookie($name[, $value = ''[, $expire = ''[, $domain = ''[, $path = '/'[, $prefix = ''[, $secure = false[, $httpOnly = false]]]]]]])
Parameters:
- $name(mixed) –Cookie name or affiliated exhibit of the entirety of the parameters accessible to this capacity
- $value(string)–Cookie esteem
- $expire(int)– Number of seconds until termination
- $domain(string)–Cookie space (generally: .yourdomain.com)
- $path(string)– Cookie way
- $prefix(string)– Cookie name prefix
- $secure(bool)– Whether to just send the treat through HTTPS
- $httpOnly (bool) – Whether to conceal the treat from JavaScript
Return type:
- void
This aide work gives you more amiable grammar to set program treats. Allude to the Response Library for a depiction of its utilization, as this capacity is an assumed name for Response::setCookie().
get_cookie($index[, $xssClean = false])
Parameters:
- $index (string) – Cookie name
- $xss_clean (bool) – Whether to apply XSS sifting to the brought an incentive back
Returns:
- The treat worth or NULL if not found
Return type:
- mixed
This assistant capacity gives you more amicable linguistic structure to get program treats. Allude to the IncomingRequest Library for point by point portrayal of its utilization, as this capacity demonstrations correspondingly to IncomingRequest::getCookie(), with the exception of it will likewise prepend the $cookiePrefix that you might've set in your application/Config/App.php record.
delete_cookie($name[, $domain = ''[, $path = '/'[, $prefix = '']]])
Parameters:
- $name (string) – Cookie name
- $domain (string) – Cookie space (for the most part: .yourdomain.com)
- $path (string) – Cookie way
- $prefix (string) – Cookie name prefix
Return type:
- void
Lets you erase a treat. Except if you've set a custom way or different qualities, just the name of the treat is required.
delete_cookie('name');
This capacity is in any case indistinguishable from set_cookie(), then again, actually it doesn't have the worth and termination parameters. You can present a variety of qualities in the main parameter or you can set discrete parameters.
delete_cookie($name, $domain, $path, $prefix);