doujubeng2942 2016-04-22 13:34
浏览 45

Symfony 2.7路由错误?

I'm studying Symfony2 making test program. I met some errors about symfony routing error. The error is:

Class AppBundle\Controller\DefaultController does not exist in C:\projects\classic-symfony\src\AppBundle/Controller/ 

(which is being imported from "C:\projects\classic-symfony\app/configouting.yml").

Certainly I deleted , so 2 lines are written, DefaultController.php in C:\projects\classic-symfony\src\AppBundle/Controller/, and deployed ToppageController.php instead of it.

ToppageController.php is very simple and the following,

<?php

namespace AppBundle\Controller;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;

class ToppageController extends Controller
{
    /**
     * @Route("/")
     */
    public function indexAction()
    {
        return $this->rendor('Toppage/index.html.twig');    
    }
}

Why does this code not work ? This is routing problem ?


4.23.2016 Thank you everyone. I'm out of office so will try and response next week.


4.25.2016 I replied new problem to this reply. Could you help this problem ?

  • 写回答

3条回答 默认 最新

  • duanliaolan6178 2016-04-22 14:05
    关注

    You need to delete your route to this controller from app/config/routing.yml.

    After that don't forget to clear the cache. In dev environment you can just run:

    php app/console cache:clear
    

    In prod environment you need to add parameter:

    php app/console cache:clear --env=prod
    
    评论

报告相同问题?

悬赏问题

  • ¥15 maple软件,用solve求反函数出现rootof,怎么办?
  • ¥50 汇编语言除法溢出问题
  • ¥65 C++实现删除N个数据列表共有的元素
  • ¥15 Visual Studio问题
  • ¥15 state显示变量是字符串形式,但是仍然红色,无法引用,并显示类型不匹配
  • ¥20 求一个html代码,有偿
  • ¥100 关于使用MATLAB中copularnd函数的问题
  • ¥20 在虚拟机的pycharm上
  • ¥15 jupyterthemes 设置完毕后没有效果
  • ¥15 matlab图像高斯低通滤波