2013-02-23 51 views
0

我做了一個「/」在我的路線格局:與下列動作的/路由模式總是讓我看到Symfony的歡迎頁面,而不是我的控制器

acme_store_index: 
    pattern:/
    defaults: { _controller: AcmeStoreBundle:Default:index} 

public function indexAction() 
{ 
    $message = $this->getDoctrine() 
    ->getRepository('AcmeStoreBundle:Message') 
    ->findAll(); 

    return $this->render(
    'AcmeStoreBundle:Default:index.html.twig', 
    array('message' => $message) 
    );  
} 

我也在Apache中設置了一個虛擬主機,聲明爲localhost的索引頁文件app_dev.php。 (這種方式,我不必一直在我的網址中包含它,當我正在做阿賈克斯呼叫等)

爲什麼我的/路線被忽略?

+1

檢查'app/config/routing_dev.yml'並刪除路由條目 – Federkun 2013-02-23 09:59:27

回答

1

,我發現自己的問題..

有我AcmeDemoBundle宣佈/路線:

_welcome: 
    pattern:/
    defaults: { _controller: AcmeDemoBundle:Welcome:index } 

的/app/config/routing_dev.yml文件中。我刪除了它,並獲得了自己的索引。

+0

如果您尚未完成,請按照[Symfony入門](https://github.com/symfony/symfony-standard#4 -getting-started-with-symfony)刪除演示包 – Federkun 2013-02-23 10:02:22

+0

謝謝,我錯過了我應該刪除的部分,我想.. – 2013-02-24 00:00:30

相關問題