加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 站长学院 > PHP教程 > 正文

php – YAML文件不能包含制表符为缩进

发布时间:2020-12-13 14:05:11 所属栏目:PHP教程 来源:网络整理
导读:这是我第一次使用symfony 2.所有我想在这里做的是每当用户点击提交按钮,他将去另一个页面. 但是我的索引页没有加载.他们说我的路由文件有问题.我不知道我做错了什么这是我的路由文件.请帮帮我. community_online_shop_homepage: pattern: / defaults: { _con
这是我第一次使用symfony 2.所有我想在这里做的是每当用户点击提交按钮,他将去另一个页面.

但是我的索引页没有加载.他们说我的路由文件有问题.我不知道我做错了什么这是我的路由文件.请帮帮我.

community_online_shop_homepage:
    pattern: /
    defaults: { _controller: CommunityOnlineShopBundle:Page:index }
_login:
    pattern: /login
    defaults: { _controller: CommunityOnlineShopBundle:Page:login}

请帮帮我.我被困了几个小时

YAML文件使用空格作为缩进,您可以使用2或4个空格进行缩进,但不使用选项卡.换句话说,禁止标签缩进:

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.

(来源:YAML FAQ(感谢Destiny Architect的链接))

例如,Symfony configuration file可以写入2或4个空格作为缩进:

4个空格

doctrine:
    dbal:
        default_connection: default

2个空格

doctrine:
  dbal:
    default_connection: default

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读