最佳答案
emmm...看错题目了...我还以为是怎么保证不过期...从源码可以看出来默认是永久,所以没法设置有效期,除非自己重写...
——————————————————————————————————————————————
我记得默认就是永久的,从源码里也可以看出来是永久的,用了CookieJar
的forever
函数
/**
* Create a "remember me" cookie for a given ID.
*
* @param string $value
* @return \Symfony\Component\HttpFoundation\Cookie
*/
protected function createRecaller($value)
{
return $this->getCookieJar()->forever($this->getRecallerName(), $value);
}
讨论数量:
emmm...看错题目了...我还以为是怎么保证不过期...从源码可以看出来默认是永久,所以没法设置有效期,除非自己重写...
——————————————————————————————————————————————
我记得默认就是永久的,从源码里也可以看出来是永久的,用了CookieJar
的forever
函数
/**
* Create a "remember me" cookie for a given ID.
*
* @param string $value
* @return \Symfony\Component\HttpFoundation\Cookie
*/
protected function createRecaller($value)
{
return $this->getCookieJar()->forever($this->getRecallerName(), $value);
}
推荐文章: