我将我的环境从 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] 删除。
我来说两句