3

如何在不编辑 routing.yml 的情况下更改路由中的 /api 以使其对我的客户可配置?

api_entry:
   path:      /api/{method}
   defaults:  { _controller: WarrenApiBundle:Api:method }
4

1 回答 1

3

您可以为此目的引入一个配置参数来配置...

# app/config/config.yml
parameters:
    api_prefix:  your_api

...然后在您的 routing.yml 中使用它

# app/config/routing.yml
api_entry:
    path:      /%api_prefix%/{method}
    defaults:  { _controller: WarrenApiBundle:Api:method }
于 2013-06-13T23:19:54.397 回答