Good D
Good D

Reputation: 9

Cakephp doesn't read browser cookie

It is tricky for me since I'm a newbie to cakephp.

So, the problem:

I have a cookie called "userClick" which I store through jQuery. But I need to read it in some cases in cakephp. The problem now is that cakephp doesn't recognize it.

If I use $_COOKIE it works fine but with var_dump( $this->Cookie->read('userClick')) I get an empty array, is there something to do?

Upvotes: 0

Views: 163

Answers (1)

Thanasis Pap
Thanasis Pap

Reputation: 2051

Try adding 'Cookie' to your components (in the controller class, a parameter should be named components):

var $components = array('Cookie');

See here: http://book.cakephp.org/1.3/en/The-Manual/Core-Components/Cookies.html

Upvotes: 1

Related Questions