doutidi5037 2014-05-24 00:18
浏览 35
已采纳

如何注销会话Symfony Fos:Userbundle

I am new to Symfony2, i am using FOSUserBundle. I overwrote the default template for the FOSUserBundle, and doing so i have lost the 'loggout' link on the profile page at

             resource: "@FOSUserBundle/Resources/config/routing/profile.xml" 

Is there a way to loggout from the symfony tool bar at the bottom?

and what is the resource link to loggout a user in fosUserBundle

  • 写回答

1条回答 默认 最新

  • dongqiao9583 2014-05-24 23:06
    关注

    I think, that the default route for logout in FOSUerBundle is "fos_user_security_logout", so you can generate a logout link anywhere in your site with this route:

    <a href="{{ path('fos_user_security_logout') }}">
    

    It is also possible to add a new block to the Symfony2 debug toolbar with the logout link. You should have a look here: Adding Web Profiler Templates

    You can extend the 'WebProfilerBundle:Profiler:layout.html.twig' layout and add the custom content to the toolbar block.

    {% block toolbar %}
        {# the web debug toolbar content #}
    {% endblock %}
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
编辑
预览

报告相同问题?

手机看
程序员都在用的中文IT技术交流社区

程序员都在用的中文IT技术交流社区

专业的中文 IT 技术社区,与千万技术人共成长

专业的中文 IT 技术社区,与千万技术人共成长

关注【CSDN】视频号,行业资讯、技术分享精彩不断,直播好礼送不停!

关注【CSDN】视频号,行业资讯、技术分享精彩不断,直播好礼送不停!

客服 返回
顶部