【问题标题】:Symfony 2.1 - Uncaught PHP Exception Twig_Error_RuntimeSymfony 2.1 - 未捕获的 PHP 异常 Twig_Error_Runtime
【发布时间】:2013-05-23 07:44:46
【问题描述】:

尝试在 Symfony 2.1 中打开路由时遇到此错误

我真的不知道在哪里检查。网上什么都没有。

非常感谢您的帮助:

CRITICAL - 未捕获的 PHP 异常 Twig_Error_Runtime:“在渲染模板期间引发了异常(“无法为命名路由“_wdt”生成 URL,因为此类路由不存在。”)在“@WebProfiler/ Profiler/toolbar_js.html.twig”在第 15 行。”在 /home/milos/workspace/merrin3.0/vendor/twig/twig/lib/Twig/Template.php 第 280 行

【问题讨论】:

  • 请检查我的回答,如果有帮助就回复:)

标签: php symfony twig symfony-2.1


【解决方案1】:

如果启用了 profiler 但缺少路由配置,则会在 dev 环境中引发此异常。

Unable to generate a URL for the named route "_wdt" as such route does not exist.

请检查您的 app/config/routing_dev.yml 是否包含以下行:

# app/config/routing_dev.yml

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

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

这将解决您的问题。

【讨论】:

  • 完美,非常感谢。问题是我删除了 routing_dev.yml 并将其更改为 config_dev.yml 以指向 router: { resource: "%kernel.root_dir%/config/routing_dev.yml" }
【解决方案2】:

重命名文件夹 vendor 或删除(项目备份),再次使用 composer install。(服务器 Windows)(Symfony 2.3.35)

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2014-05-11
    • 1970-01-01
    • 1970-01-01
    • 2016-02-24
    • 2017-12-11
    • 1970-01-01
    • 1970-01-01
    • 2023-03-15
    相关资源
    最近更新 更多