我的应用程序中有一个神奇的 所有路径都可以正常工作,但现在我创建了一个新的控制器并且找不到它的路径。 p>
如果我访问网址 说 可能我只是忘了一个愚蠢的小细节,但我现在真的被卡住了,所以任何提示都会受到赞赏。 p>
div> No route found code>。 我在控制器中使用注释。 我的
app / config / routing.yml code>如下所示: p>
app:
resource:“@ AppBundle / Controller /”
type: 注释
code> pre>
<?php
命名空间AppBundle \ Controller;
使用Symfony \ Component \ HttpFoundation \ Request;
使用Symfony \ Bundle \ FrameworkBundle \ Controller \ Controller;
使用Sensio \ Bundle \ FrameworkExtraBundle \ Configuration \ Method;
使用Sensio \ Bundle \ FrameworkExtraBundle \ Configuration \ Route;
使用Sensio \ Bundle \ FrameworkExtraBundle \ Configuration \ Template;
使用Sensio \ Bundle \ FrameworkExtraBundle \ Configuration \ Security;
使用Sensio \ Bundle \ FrameworkExtraBundle \ Configuration \ ParamConverter;
/ **
*导出控制器。
* @Route(“/ export”)
* /
类ExportController扩展Controller {
/ *
* @Route (“/”)
* /
公共函数showExportPage(Request $ request)
{
返回$ this - >渲染('AppBundle:export.html.twig');
}
}
?>
code> pre>
找不到“GET / export” code>的路由。 此外,如果我在控制台中执行
router:debug code>,则不会列出路由。 我已多次清除缓存,但没有帮助。 p>
I have a misterious case of No route found
in my application. I use annotations in my controllers. My app/config/routing.yml
looks like this:
app:
resource: "@AppBundle/Controller/"
type: annotation
All routes work perfectly fine, but now I created a new controller and it doesn't find its routes.
<?php
namespace AppBundle\Controller;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Method;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Security;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\ParamConverter;
/**
* Export controller.
* @Route("/export")
*/
class ExportController extends Controller{
/*
* @Route("/")
*/
public function showExportPage(Request $request)
{
return $this->render('AppBundle:export.html.twig');
}
}
?>
If I visit the url it says No route found for "GET /export"
. Also if I do router:debug
in the console, the route doesn't get listed. I have cleared the cache several times, it doesn't help.
Probably I just forgot a stupid little detail, but I am really stuck right now, so any hints are appreciated.