【问题标题】:Symfony 2 - No route found for "GET /videotheque"Symfony 2 - 找不到“GET /videotheque”的路线
【发布时间】:2012-07-30 09:23:58
【问题描述】:

我需要一些帮助,因为我没有成功找到路线问题的根源。

这是我的routing.yml

gstyle39VideothequeBundle:
    resource: "@gstyle39VideothequeBundle/Resources/config/routing.yml"
    prefix: /videotheque

VideothequeBundle/Resources/config/ 中的routing.yml

VideothequeBundle_homepage:
    pattern:  /
    defaults: { _controller: gstyle39VideothequeBundle:Videotheque:index }

我的控制器:

<?php

namespace gstyle39\VideothequeBundle\Controller;

use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
use Symfony\Component\HttpFoundation\Response;

class VideothequeController extends Controller
{    
    public function indexAction()
    {
        return new Response("Kikoo");
    }
}

就我而言,我做了一个“cache:clear”,一个检测到我的路由的“router:debug”:

VideothequeBundle_homepage ANY /videotheque/

我还手动删除了文件夹app/cache...

【问题讨论】:

  • router:debug 正在输出时,您必须在您的网址末尾附加一个斜杠。
  • 你错过了结尾/吗?你的路线应该是http://yourpage.local/videotheque/(注意结尾的斜线)。
  • 我已经测试过,但错误仍然在这里

标签: php symfony yaml


【解决方案1】:

恕我直言,您没有在应用程序全局 routing.yml (app/config/routing.yml) 中添加路由定义。

看看我在https://github.com/drupalmk/Jobeeto中的路由定义

【讨论】:

  • 您好,我添加了路由定义,但又出现错误
  • 你能提供你所有的配置吗?
  • 我已经重新安装了 Symfony2,并且我再次编码了我所有的路由和控制器......终于它工作了。谢谢你的时间。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2018-09-12
  • 1970-01-01
  • 1970-01-01
  • 2018-05-30
  • 1970-01-01
  • 2018-10-24
  • 1970-01-01
相关资源
最近更新 更多