我按照需要做了一切,但我的“记住我”标记尚未设置。
我跟踪代码直到/vendor/symfony/src/Symfony/Component/Security/Http/RememberMe/TokenBasedRememberMeService.phpcookie 设置的位置
$response->headers->setCookie(
new Cookie(
$this->options['name'],
$value,
$expires,
$this->options['path'],
$this->options['domain'],
$this->options['secure'],
$this->options['httponly']
)
);
当我转储 $response->headers 时,cookie 部分如下所示:
["cookies":protected]=> array(1) { [""]=> array(1) { ["/"]=> array(1) { ["REMEMBERME"]=> object(Symfony\Component\HttpFoundation\Cookie)#753 (7) { ["name":protected]=> string(10) "REMEMBERME" ["value":protected]=> string(176) "V2Vic3BpblxVc2VyQnVuZGxlXEVudGl0eVxVc2VyOmJXRmliMmRwWlVCbmJXRnBiQzVqYjIwPToxMzM5MjQ5Mjc5OmJjY2QxMWYxNGNkZmQxZmI5ZTNjOTBhYTBiMTEyNjEwYzdkMWYxOGYwYWQzMmMzYmJhYzZlODM3Yjc0Nzc3Mjk=" ["domain":protected]=> NULL ["expire":protected]=> int(1339249279) ["path":protected]=> string(1) "/" ["secure":protected]=> bool(false) ["httpOnly":protected]=> bool(true) } } } }
cookies 数组第一个元素的键为空。那是对的吗?
如果这是正确的,为什么 cookie 没有设置?
edit:我的 security.yml:
firewalls:
main:
pattern: ^/
form_login:
provider: fos_userbundle
login_path: fos_user_security_login
check_path: fos_user_security_check
logout:
path: _security_logout
target: _welcome
anonymous: true
remember_me:
key: "%secret%"
lifetime: 36000
path: /
domain: ~
如果您需要更多信息,请告诉我。