Cookie
This library is useful because it standardizes setting and getting cookies. In some cases, such as when using iFrames on certain version of Internet Explorer, special server-side headers need to be sent to ensure everything works properly.
Properties
No public properties available.
set()
Set a cookie with a specific name. If expiration date is omitted, then it is for the session only. You can also use the alias add() which does the same thing.
$this->zajlib->cookie->set('my_cookie', 'value');
@param string $name The name of the cookie.
@param string $value The new value of the cookie.
@param int|string $expiration The new expiration date of the cookie. 0 means only this session.
@param boolean $subdomains Make it available to all subdomains if this is true. Default is false.
@param boolean $secure Set this to true if you only want this cookie in secure mode. Default is false.
@param boolean $httponly Set this to true if you only want this cookie in http mode. Default is true.
@return bool Returns true if successful, false if not.
get()
Get a cookie value. Unlike set(), this does nothing special, so you may use the built-in $_COOKIE array instead.
$this->zajlib->cookie->get('my_cookie');
@param string $name The name of the cookie.
@return string Returns the cookie value.
remove()
Remove a cookie by its name. You can also use its alias delete().
$this->zajlib->cookie->remove('my_cookie', true);
@param string $name The name of the cookie.
@param boolean $subdomains Remove it available from all subdomains if this is true. Default is false.
@return string Returns the cookie value.
remove_all()
Remove all cookies. You can also use its alias delete_all().
$this->zajlib->cookie->remove_all();
@return integer Returns the number of cookies removed.