symfony命令列產生bundle後訪問對應地址報404

來源:互聯網
上載者:User
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 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
本人對於這個架構只限於看了官方的文檔,我自己研究了會不知道為啥還是不行
望哪位大大 能提點下~~

你試過清除cache了嗎?
清除命令是:

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

同樣的,你需要檢查route是否配置正確

app/console router:debug

路由是 /hello/{name}
你訪問 /hello/mot 就有了

  • 聯繫我們

    該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

    如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.