使用加密密钥时如何获取cookie的原始值

时间:2014-03-18 11:55:40

标签: cakephp cookies encryption

我正在使用

public function beforeFilter() {
   parent::beforeFilter();
   //$this->Cookie->name='cookie_test'; 
   //$this->Cookie->time=3600; 
   //$this->Cookie->path=''; 
   //$this->Cookie->domain=''; 
   //$this->Cookie->secure=false; 
   //$this->Cookie->key='39lbkutg1i2l0kta6785d8qki5'; 
   //$this->Cookie->httpOnly=true; >
}

用于设置cookie,但当我尝试阅读时,它会以加密形式出现。

1 个答案:

答案 0 :(得分:0)

你不需要写这个功能。你可以完全删除它。

当你设置你的Cookie时。什么你写它应该给你读取的价值。

e.g。如果你写

$this->Cookie->write('name', 'Larry'); 

当你通过

阅读时
$this->Cookie->read('name'); 

它给了你"拉里"