Symfony 7中Flash Message无法正常显示问题求助
Symfony Flash Message跳转后不显示,添加dd()再刷新才正常的问题
我的代码如下:
$form = $forumService->handleDiscussionForm($request); if ($form === "submitted") { $this->addFlash('success', 'Your discussion has been successfully created and must be validated by Parentela.'); return $this->redirectToRoute('app_forum_thematique', ['slug' => $thematique->getSlug()]); }
测试1:提交表单后,页面正确跳转到app_forum_thematique路由,但Flash Message完全不显示。
测试2:修改代码后:
$form = $forumService->handleDiscussionForm($request); if ($form === "submitted") { $this->addFlash('success', 'Your discussion has been successfully created and must be validated by Parentela.'); dd("test"); return $this->redirectToRoute('app_forum_thematique', ['slug' => $thematique->getSlug()]); }
提交表单后页面显示test;此时移除dd()代码并刷新页面,Flash Message能正常显示,跳转也没问题。
为什么不加dd()的时候Flash Message就无法正常显示?有没有人遇到过同样的问题?
内容的提问来源于stack exchange,提问作者Alan
相关产品推荐
相关产品推荐

