2017-04-10 29 views
0

正如標題所示我有這個問題,如果我嘗試到達以下網址:發現「GET/SF /客戶先編程'級別的」無路由

http://app.local/sf/customer-first-progam-level 

這是我有:

  • 應用程序/ routing.yml中

    quote: 
        resource: "@QuoteBundle/Controller/" 
        type:  annotation 
        prefix: /sf 
    
  • QuoteBundle /控制器/ CustomerFirstProgramLevelController.php

    <?php 
    
    namespace QuoteBundle\Controller; 
    
    use Sensio\Bundle\FrameworkExtraBundle\Configuration\Method; 
    use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route; 
    use Symfony\Bundle\FrameworkBundle\Controller\Controller; 
    use Symfony\Component\HttpFoundation\Request; 
    
    /** 
    * @Route("customer-first-program-level") 
    */ 
    class CustomerFirstProgramLevelController extends Controller 
    { 
        use GridBuilder; 
    
        /** 
        * @Route("/", name="customer_first_program_level_index") 
        * @Method({"GET", "POST"}) 
        * @param Request $request 
        * 
        * @return \Symfony\Component\HttpFoundation\Response 
        * @throws \LogicException 
        */ 
        public function indexAction(Request $request) 
        { 
         ... 
        } 
    } 
    

這是我沒有成功嘗試:

  • 清除緩存都PROD和DEV
  • 更改路線名稱到別的東西

如果我調試router我得到以下內容:

$ symfony_console debug:router 
------------------------------------ ---------- -------- ------ -------------------------------------------- 
    Name         Method  Scheme Host Path           
------------------------------------ ---------- -------- ------ --------------------------------------------       
    customer_index      GET|POST ANY  ANY /sf/customer/        
    customer_first_program_level_index GET|POST ANY  ANY /sf/customer-first-program-level/   
    discount_index      GET|POST ANY  ANY /sf/discount/        
    ....   
------------------------------------ ---------- -------- ------ -------------------------------------------- 

我正在使用Symfony 3.2.7。有任何想法嗎?我在他們之外

+3

嘗試使用http://app.local/sf/customer-first-progam-level/並以斜線結尾。如果您希望URL在結尾改爲「/」到「」時沒有斜槓 –

+0

我同意@FrankB。你的休息路線不完整 – Chris

+0

@FrankB似乎並不是問題,我已經嘗試添加尾隨斜線並將其從路線中移除並且仍然不工作,這很奇怪,我的所有控制器都具有相同的結構並且沒有,但是這失敗了 – ReynierPM

回答

0

我會回答自己和道歉對於那些誰試圖回答,但問題是這樣虛擬沒有人發現它(包括我自己)。如果你仔細看看我的測試URL和路線定義,你會看到有在網址中有錯字:

  • 網址:/sf/customer-first-progam-level
  • @Route:customer-first-program-level

問題progam (URL)與program(路由定義)

-2

嘗試app.local/sf/customer-first-progam-level用斜線結束。如果你想成爲的網址不上「/」的註釋爲「」到底改變斜槓