Login +

How To ? / Using Cookie

Imagine you want to store all information of a user in its cookies:

$this->_generic->useModel("Author");
$author = new Main_Author();

if ($author->getModel(1))
{
    $cookie = new SLS_Cookie("test_sls");
    $cookie->__set("account", $author->getParams());
    $cookie->save();
}

To retrieve informations:

$cookie = new SLS_Cookie("test_sls");
var_dump($cookie->__get("account"));

References

  1. SLS_Cookie - SLS_Cookie class - Manage cookie