drtoaamk20278 2016-01-28 09:59
浏览 55
已采纳

从上下文Symfony中删除经过身份验证的用户

I would like to know the instruction how to remove a user that has just been authenticated so it would be like no user has been authenticated.

Should I delete the content of the session or is there a proper way ?

  • 写回答

2条回答 默认 最新

  • dongyue0263 2016-01-28 10:06
    关注

    you can try this :

    $this->get('security.token_storage')->setToken(null);
    $this->get('request')->getSession()->invalidate();
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?