Symfony-仅在开发人员中定义路线。环境 [英] Symfony - Defining a route only in dev. environment

查看:63
本文介绍了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.

推荐答案

您可以在 routing_dev.yml ( Symfony 2/3)或在 config / routes / dev / (Symfony 4)中创建仅开发路由文件。

You can add your route in routing_dev.yml (Symfony 2/3) or create a dev-only routing file in config/routes/dev/ (Symfony 4).

这篇关于Symfony-仅在开发人员中定义路线。环境的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆