如标题所示,如果我尝试访问以下网址,则会出现此问题:
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)
{
...
}
}
这是我尝试过的但没有成功:
如果我调试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。有任何想法吗?我不在他们身边
答案 0 :(得分:0)
我会回答自己,并为那些试图回答的人道歉,但问题是 虚拟 ,没有人找到它(包括我自己)。如果您仔细查看我的测试网址和路线定义,您会看到网址上有拼写错误:
/sf/customer-first-progam-level
customer-first-program-level
问题progam
(网址)与program
(路线定义)
答案 1 :(得分:-2)
在最后用斜杠尝试app.local/sf/customer-first-progam-level
。如果你想让网址在结束时没有斜线改变&#34; /&#34;到&#34;&#34;在注释中