symfony命令行生成bundle后访问对应地址报404



 php app/console generate:bundle --namespace=Acme/HelloBundle --format=yml

这个语句一直回车生成代码之后 然后 访问/app_dev.php/hello/ 显示

No route found for "GET /hello/"

配置如下:


 #Resources\config\routing.yml
    acme_hello_homepage:
        path:     /hello/{name}
        defaults: { _controller: AcmeHelloBundle:Default:index }

   #app\config\routing.yml
    acme_hello:
    resource: "@AcmeHelloBundle/Resources/config/routing.yml"
    prefix:   /

symfony 版本为2.5.6
本人对于这个框架只限于看了官方的文档,我自己研究了会不知道为啥还是不行
望哪位大大 能提点下~~

php-框架 symfony php

夜袭·寡妇村 9 years, 7 months ago

路由是 /hello/{name}
你访问 /hello/mot 就有了

himiko answered 9 years, 7 months ago

你试过清除cache了吗?
清除命令是:


 app/console cache:clear --env=prod
app/console cache:clear --env=dev

同样的,你需要检查route是否配置正确


 app/console router:debug

Miskey answered 9 years, 7 months ago

Your Answer