A YAML file cannot contain tabs as indentation

后端 未结 4 1439
孤街浪徒
孤街浪徒 2020-11-30 05:23

This is my first work with Symfony 2. All I am trying to do here is whenever the user clicks on the submit button he will go to another page.

But my index page isn\'

相关标签:
4条回答
  • 2020-11-30 06:07

    Can you try cache:clear or try using path instead of pattern.

    The path option is new in Symfony2.2, pattern is used in older versions.

    community_online_shop_homepage:
        path: /
        defaults: { _controller: CommunityOnlineShopBundle:Page:index }
    _login:
        path: /login
        defaults: { _controller: CommunityOnlineShopBundle:Page:login }
    
    0 讨论(0)
  • 2020-11-30 06:11

    IF you are using EditorConfig make sure to add this to your .editorconfig file

    [*.yml]
    indent_style = space
    indent_size = 4
    

    you can change indent_size to 2, depends on your preferences

    0 讨论(0)
  • 2020-11-30 06:16

    A YAML file cannot contain tabs as indentation, so the mistake is here: C:\\xampp\\htdocs\\api\\app/../src/AppBundle/Resources/config/valida tor.yml" at line 9 (near " - { resource: validators/services.yml }").

    0 讨论(0)
  • 2020-11-30 06:24

    A YAML file use spaces as indentation, you can use 2 or 4 spaces for indentation, but no tab. In other words, tab indentation is forbidden:

    Why does YAML forbid tabs?

    Tabs have been outlawed since they are treated differently by different editors and tools. And since indentation is so critical to proper interpretation of YAML, this issue is just too tricky to even attempt. Indeed Guido van Rossum of Python has acknowledged that allowing TABs in Python source is a headache for many people and that were he to design Python again, he would forbid them.

    (source: YAML FAQ (thanks to Destiny Architect for the link))

    For example, the Symfony configuration file can be written with 2 or 4 spaces as indentation:

    4 spaces

    doctrine:
        dbal:
            default_connection: default
    

    2 spaces

    doctrine:
      dbal:
        default_connection: default
    
    0 讨论(0)
提交回复
热议问题