Symfony - 仅在开发中定义路由.环境 [英] Symfony - Defining a route only in dev. environment
本文介绍了Symfony - 仅在开发中定义路由.环境的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在使用 SF2,我创建了一些帮助项目调试的路由:
I'm using SF2 and I created some routes helping the debugging of the project:
widget_debug_page:
path: /debug/widget/{widgetName}
defaults: { _controller: WidgetBundle:Debug:default }
问题是这条路线在投入生产时绝不能达到.
The problem is that this route MUST never be reachable when going in production.
我找不到指定环境的参数.
I could not find a parameter to specify the environment.
推荐答案
只为想要使用 annotation
系统的人:
Just for people who want use with annotation
system:
/**
* @Route("/my-route", condition="'dev' === '%kernel.environment%'")
*/
public function index() {}
这篇关于Symfony - 仅在开发中定义路由.环境的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文