Wednesday, October 26, 2011

Cannot read Cookies in other method

Hello,

if inside a function trying this>

$this->Cookie->write('userid',$userId[0]['User']['id'],true,3600);
debug ($this->Cookie->read('userid'));

Obtain a right value.

But if i trying read value of cookie in some other function in same
controller get always a empty value

function account()
{

debug ($this->Cookie->read('userid'));
}


I dont know what can be wrong..

Settings is>

function beforeFilter() {
$this->Cookie->name = 'teacher';
$this->Cookie->time = 3600; // or '1 hour'
$this->Cookie->path = '/';
//$this->Cookie->domain = 'localhost';
$this->Cookie->secure = true; //i.e. only sent if using secure
HTTPS
$this->Cookie->key = 'qSI232qs*&sXOw!';
}


Thanks very much for any help.

--
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: