douhuanbai6729
2017-07-24 13:54
浏览 77
已采纳

如何在Symfony3 routing.yml中更改优先级

I have the following generic routing on my symfony project as in (routing.yml):

appsite2:
    path:     /{req}/{var}
    defaults: {_controller: AppBundle:Default:index}

However, it overwrites the routing api/doc as:

NelmioApiDocBundle:
    resource: "@NelmioApiDocBundle/Resources/config/routing.yml"
    prefix:   /api/doc

So how can I change the first routing and put exception for {var}, something like: if({req}/{var} != '/api/doc')?

Note: I already tried to change the order of the 2 routes and it doesn't work.

图片转代码服务由CSDN问答提供 功能建议

我的symfony项目中有以下通用路由,如(routing.yml):

  appsite2:
 path:/ {req} / {var} 
默认值:{_ control:AppBundle:默认值:index} 
   
 
 <  p>但是,它将路由 api / doc 覆盖为: 
 
 
  NelmioApiDocBundle:
 resource:“@ NelmioApiDocBundle / Resources / config / routing。  yml“
前缀:/ api / doc 
   
 
 

那么如何更改第一个路由并为 {var} 添加异常, 类似于: if({req} / {var}!='/ api / doc')

注意:我已经尝试改变顺序 2条路线,它不起作用。

  • 写回答
  • 好问题 提建议
  • 追加酬金
  • 关注问题
  • 邀请回答

1条回答 默认 最新

相关推荐 更多相似问题