Symfony - 路由中的错误404

时间:2015-07-31 02:27:16

标签: symfony symfony-2.7

当我运行服务器并尝试URL时,我收到错误404.

的src /的appbundle /资源/配置/ routing.yml中

app_category:
    resource: "@AppBundle/Resources/config/routing/category.yml"
    prefix:   /category

的src /的appbundle /资源/配置/路由/ category.yml

category:
    path:     /
    defaults: { _controller: "AppBundle:Category:index" }
category_new:
    path:     /new
    defaults: { _controller: "AppBundle:Category:new" }

CategoryController

class CategoryController extends Controller
{

    /**
     * Lists all Category entities.
     *
     */
    public function indexAction()
    {
        $em = $this->getDoctrine()->getManager();

        $entities = $em->getRepository('AppBundle:Category')->findAll();

        return $this->render('AppBundle:Category:index.html.twig', array(
            'entities' => $entities,
        ));
    }

    public function newAction()
    {
        $entity = new Category();
        $form   = $this->createCreateForm($entity);

        return $this->render('AppBundle:Category:new.html.twig', array(
            'entity' => $entity,
            'form'   => $form->createView(),
        ));
    }

}

enter image description here enter image description here

我做错了什么?

0 个答案:

没有答案