Phalconphp cookie getValue return null


Phalconphp cookie getValue return null

我需要将信息存储到cookie中,Phalcon正确地设置了cookie,但它不会返回它,例如:

if(!$this->cookies->has('t')){
        $this->cookies->set('t', 'test', (10*(365*(24*(60*60))))+time(), '/', null, '*');
}
$c = $this->cookies->get('t');//when i dump this i can see cookie value as protected value
$c->getValue(); // but here i got null

正如我在注释中所描述的,当我调用getValue时,我得到了null,但是为什么当我可以看到转储中的值时?

您使用的是哪个版本的Phalcon ?

我的版本是2.0.3,我使用这个:

$this->cookies->get('lang')->getValue()

返回正确的值:/

你将返回的对象存储在$c中但是当我看到你的代码

时一切看起来都很好