开发者

How to define and retrieve cookie value as array in CakePHP?

How to define and retrieve cookie value as array in Cak开发者_运维技巧ePHP?


You don't need to do anything special as Cake's CookieComponent handle's arrays seamlessly.

In your controller, make sure you've included the CookieComponent:

var $components = array('Cookie');

In your action, to write an array:

$this->Cookie->write('test', array('value1', 'value2'));

And then to read it back:

$test = $this->Cookie->read('test');  // $test will be an array
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜