Friday, April 6, 2012

Missing cookies after closing browser for CakePHP

I write 5 cookies in CakePHP 2 like this:

$this->Cookie->write('atoken.n1', 'a');
$this
->Cookie->write('atoken.n2', 'b');
$this
->Cookie->write('atoken.n3', 'c');
$this
->Cookie->write('atoken.n4', 'd');
$this
->Cookie->write('atoken.n5', 'e');

My beforeFilter function:

public function beforeFilter() {
    parent
::beforeFilter();
    $this
->Cookie->name = 'tokens';
    $this
->Cookie->time = '1 hour';
    $this
->Cookie->key = 'dfg33DFGdfg';
}

After i write these cookies, i check Cookies file of Chrome and i see 5 of them exist and written properly. Then i close and reopen browser, i see only first cookie exists, other 4 cookie disappears.

How can i solve this? Thank you

--
Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.
 
 
To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php

No comments: