简体   繁体   English

如何在symfony中创建注销路径?

[英]How do I create a logout route in symfony?

I'm trying to implement a simple login and logout in my symfony app and in the documentation it says I need to create a route to the logout page. 我正在尝试在我的symfony应用程序中实现简单的登录和注销,并在文档中说我需要创建一个到注销页面的路由。 And there is a code like this: 并且有这样的代码:

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

I'm trying to paste it into my app/config/routing.yml, so it looks like this: 我正在尝试将其粘贴到我的app / config / routing.yml中,因此它看起来像这样:

# app/config/routing.yml
app:
    resource: '@AppBundle/Controller/'
    type:     annotation
logout:
    path: /logout

But I get an error 但我得到一个错误

The file "(...)\app/config\routing.yml" does not contain valid YAML

I was searching through the documentation and couldn't find anythig that would help me solve it. 我正在搜索文档,找不到任何可以帮助我解决的问题。 I can't really understand how this routing configuration file works and why I get this error. 我真的无法理解此路由配置文件的工作方式以及为什么会收到此错误。

Suggest when making changes to any yaml file in a development environment, save the yaml first, make the change, then check for error messages. 在开发环境中对任何yaml文件进行更改时提出建议,先保存yaml,进行更改,然后检查错误消息。 If you get error messages back them out. 如果收到错误消息,请将其退回。

Also set up your editor so that it points out things like tabs, spaces, etc... So it's easier to see right away. 另外,还要设置您的编辑器,使其指出制表符,空格等内容。这样一来,立即查看起来就更容易了。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM