PROD 环境中仅限 Symfony 2.6.1 应用 运行

Symfony 2.6.1 app only running in PROD enviroment

我正在开发 Symfony 2 应用程序(版本 2.6.1),但我只能在 PROD 模式下 运行 它。尝试访问以下 URL 时:

http://localhost/lawAdmin/web/app_dev.php

我收到下一条错误消息:

RouteNotFoundException in appDevUrlGenerator.php line 32: Unable to generate a URL for the named route "_profiler" as such route does not exist.

我的 routing.yml 和 routing_dev.yml 文件看起来一样:

law_admin:
    resource: "@LawAdminBundle/Controller/DefaultController.php"
    type:     annotation
    prefix:   /

运行

app/console debug:router

returns:

 [router] Current routes
 Name          Method Scheme Host Path
 porfolio_show GET    ANY    ANY  /
 gallery_show  GET    ANY    ANY  /gallery/{galleryId}

我也试过以下命令以防失败:

php app/console cache:clear

将您的路由开发人员更改为

_wdt:
    resource: "@WebProfilerBundle/Resources/config/routing/wdt.xml"
    prefix:   /_wdt

_profiler:
    resource: "@WebProfilerBundle/Resources/config/routing/profiler.xml"
    prefix:   /_profiler

_main:
    resource: routing.yml

这将在开发环境中加载探查器和工具栏路由,并从 routing.yml 文件加载您自己的应用程序路由。