正如標題所示我有這個問題,如果我嘗試到達以下網址:發現「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。有任何想法嗎?我在他們之外
嘗試使用http://app.local/sf/customer-first-progam-level/並以斜線結尾。如果您希望URL在結尾改爲「/」到「」時沒有斜槓 –
我同意@FrankB。你的休息路線不完整 – Chris
@FrankB似乎並不是問題,我已經嘗試添加尾隨斜線並將其從路線中移除並且仍然不工作,這很奇怪,我的所有控制器都具有相同的結構並且沒有,但是這失敗了 – ReynierPM