FrameworkBundle 的 Symfony 5 语法:重定向:重定向?

安德烈亚斯

我将我的环境从 symfony 4.4 升级到 5.4,之后我得到以下错误:

URI“/”的控制器不可调用:控制器“FrameworkBundle:Redirect:redirect”既不作为服务存在,也不作为类存在。

如果我使用 /admin/dashboard 之类的其他网址,它工作得很好。

我的 routes.yaml 中有这个条目,这似乎是起源:

dwbn_login_target:
  path: /
  defaults:
    _controller: FrameworkBundle:Redirect:redirect
    route: sonata_admin_dashboard
    permanent: false # this for 301path: /

如何FrameworkBundle:Redirect:redirect在 symfony 5 中实现?

吉奥弗雷达

Symfony 5 中的首选方式记录在这里:

https://symfony.com/doc/5.4/routing.html#redirecting-to-urls-and-routes-directly-from-a-route

在你的情况下:

dwbn_login_target:
    path: /
    controller: Symfony\Bundle\FrameworkBundle\Controller\RedirectController
    defaults:
        route: 'sonata_admin_dashboard'
        permanent: false

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章