Symfony3找不到“GET / logout”的路线

时间:2016-04-02 19:25:36

标签: php security yaml logout symfony

我无法通过symfony3进行注销。我一直在关注symfony文档SecurityBundle Configuration,据我所知,我可以告诉我的配置文件接缝是什么规格但是当我转到/logout时,我得到以下回复:

No route found for "GET /logout" (from "http://localhost:8000/admin")

关于我的问题可能是什么想法?

我的security.yml:

security:
encoders:
    AppBundle\Entity\User:
        algorithm: bcrypt
    Symfony\Component\Security\Core\User\User: plaintext
providers:
    chain_provider:
            chain:
                providers: [in_memory, database_provider]
    in_memory:
        memory:
          users:
            test:
                password: test
                roles: 'ROLE_ADMIN'
            admin:
                password: admin
                roles: 'ROLE_ADMIN'
    database_provider:
        entity:
            class: AppBundle:User
            property: email
firewalls:
    dev:
        pattern: ^/(_(profiler|wdt)|css|images|js)/
        security: false
    main:
        anonymous: true
        logout: true
        form_login:
            check_path: /login
            login_path: /login
            default_target_path: /login
            always_use_default_target_path: true
        logout:
            path:   /logout
            target: /login

1 个答案:

答案 0 :(得分:15)

awsver非常简单我几乎已经删除了这个问题,但我想有一个配置良好的security.yml可以成为其他遇到问题的好例子。

只需将路线添加到route.yml

即可
# app/config/routing.yml
logout:
   path: /logout