Symfony2 : Routing controllers and views in subdirectories

标签 symfony url-routing

我正在开发一个包含前端和后端的包。我遵循有关为后端和前端部件构建 Controller 和 View 的最佳方法的说明herehere .但是我找不到如何在我的路由配置文件中指定子目录。我试着把这个,但它不起作用。

post:
  pattern:  /
  defaults: { _controller: "HavactBlogBundle:Backend/Post:Backend/index" }

最佳答案

试试这个:用反斜杠替换斜杠

post:
    pattern:  /
    defaults: { _controller: "HavactBlogBundle:Backend\Post:index" }

关于Symfony2 : Routing controllers and views in subdirectories,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9761550/

相关文章:

mongodb - fatal error : Class 'Doctrine\Bundle\MongoDBBundle\DoctrineMongoDBBundle' not found

php - 如何自定义 Sylius 以销售免费产品(默认最低价格为 0.01)

symfony - 执行 phpvendor/bin/simple-phpunit 时未定义方法 ArraySubsetLegacy::exporter()

javascript - AngularJS 中的路由

php - 我的 .htaccess 有什么问题吗?仍尝试将文件作为 Controller 加载。自定义 MVC PHP

symfony - 在带有 encore 的 symfony 项目中,如何设置 Jest?

Symfony 2 -> Composer 和 CloudControl

php - 用于 PHP 的类似 Django 的 URL 路由

asp.net-mvc - 选择什么 ASP.NET MVC 路由框架?

mod-rewrite - 两个 mod 重写规则