【发布时间】:2019-03-31 01:08:13
【问题描述】:
我正在使用 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
【问题讨论】:
-
我认为您可以将安全上下文令牌设置为空,然后使会话无效。使用 PHP 时更像是一个 Laravel 人,但理论上这应该可以工作