我正在使用Symfony 3.4,我想在控制器中的操作结束时注销我的用户。
这就是行动
public function changeUserEmail() {
/* change the user email */
/* perform the logout */
/* choose the route to redirect to */
return $this->redirectToRoute(/* some route choosen above */);
}
有没有办法用Symfony的方式实现/* perform the logout */
?我在文档中没有找到任何东西。我确实想在控制器中注销(不想重定向到注销路径),我想在控制器中选择要重定向的路由。
非常感谢。
版本或Symfony是3.4
2条答案
按热度按时间4ioopgfo1#
答案在这里
不需要使所有会话无效,例如,如果一个会话定义了多个防火墙。
goucqfw62#
在Symphony 6.2中,你可以使用logout()方法: