找不到 "GET /sf/customer-first-progam-level" 的路线
No route found for "GET /sf/customer-first-progam-level"
如标题所示,如果我尝试达到以下条件,就会遇到这个问题 URL:
http://app.local/sf/customer-first-progam-level
这是我的:
app/routing.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)
{
...
}
}
这是我尝试过但没有成功的方法:
- 清除生产和开发缓存
- 将路由名称更改为其他名称
如果我调试 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。有任何想法吗?我不在他们身边
尝试在 app.local/sf/customer-first-progam-level
末尾添加一个斜杠。如果您希望 url 末尾没有斜杠,请在注释
中将“/”更改为“”
我会自己回答并为那些试图回答的人道歉,但问题是如此 dummy 以至于没有人找到它(包括我自己)。如果您仔细查看我的测试 URL 和路由定义,您会发现 URL:
上有一个拼写错误
- URL:
/sf/customer-first-progam-level
- @路线:
customer-first-program-level
问题progam
(URL)与program
(路由定义)
如标题所示,如果我尝试达到以下条件,就会遇到这个问题 URL:
http://app.local/sf/customer-first-progam-level
这是我的:
app/routing.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) { ... } }
这是我尝试过但没有成功的方法:
- 清除生产和开发缓存
- 将路由名称更改为其他名称
如果我调试 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。有任何想法吗?我不在他们身边
尝试在 app.local/sf/customer-first-progam-level
末尾添加一个斜杠。如果您希望 url 末尾没有斜杠,请在注释
我会自己回答并为那些试图回答的人道歉,但问题是如此 dummy 以至于没有人找到它(包括我自己)。如果您仔细查看我的测试 URL 和路由定义,您会发现 URL:
上有一个拼写错误- URL:
/sf/customer-first-progam-level
- @路线:
customer-first-program-level
问题progam
(URL)与program
(路由定义)