没有找到“GET/”的路径

内容来源于 Stack Overflow,并遵循CC BY-SA 3.0许可协议进行翻译与使用

  • 回答 (2)
  • 关注 (0)
  • 查看 (21)

Symfony2返回当我尝试运行http://localhost/app_dev.php时,找不到“GET /”的路径,但此网址工作:http://localhost/app_dev.php/hello/Symfony。我删除了AcmeDemoBundle,并试图从symfony2教程中运行示例包。哪里不对 ?

app / config / routing.yml:

ShopMyShopBundle:
resource: "@ShopMyShopBundle/Resources/config/routing.yml"
prefix:   /

app / config / routing_dev.yml:

_assetic:
resource: .
type:     assetic

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

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

_configurator:
resource: "@SensioDistributionBundle/Resources/config/routing/webconfigurator.xml"
prefix:   /_configurator

_main:
resource: routing.yml

src / Shop / MyShopBundle / Resources / config / routing.yml:

ShopMyShopBundle_homepage:
pattern:  /hello/{name}
defaults: { _controller: ShopMyShopBundle:Main:index }
requirements:
    _method:  GET
提问于
用户回答回答于

问题是你没有路径/。将你的定义更改为:

ShopMyShopBundle_homepage:
    pattern:  /
    defaults: { _controller: ShopMyShopBundle:Main:index }
    requirements:
        _method:  GET
用户回答回答于

正确的答案是:清除“prod”缓存:

php app/console cache:clear --env prod

扫码关注云+社区