如标题所示,如果我尝试访问以下 URL,则会遇到该问题:
http://app.local/sf/customer-first-progam-level
这就是我所拥有的:
应用程序/路由.yml
quote: resource: "@QuoteBundle/Controller/" type: annotation prefix: /sf
QuoteBundle/Controller/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。有任何想法吗?我不在他们身边