duanguochi6194 2013-12-13 15:24
浏览 44
已采纳

Symfony2重定向操作显示中间页面

I've been using the following method for redirecting users from a page to another whenever they have successfully achieved something in the lines of a CRUD action;

return $this->redirect($this->generateUrl('_my_route'));

This, normally goes well. The user finishes the action, and gets redirected without any problems to the following page. But now I've got an action that does it differently without no apparent reason. It finished my request in the controller. It hits the above redirect statement and it shows me the following intermediate page;

Redirecting to /my/route/somewhere/on/the/site/.

And after showing this to me, it actually redirects me to the page I'm looking for after a short pause. Why is this happening? And what can I do to prevent it? I don't wanna see that I'm being redirected. And what's more frustrating; how is it possible that 19 redirects DONT do this, and this one does?

Thanks

  • 写回答

1条回答 默认 最新

  • 普通网友 2013-12-13 15:35
    关注

    This is because the headers have already been sent, somewhere. Check for any debug code - in fact, if you keep hitting esc on your keyboard to stop the javascript location change, and then inspect the source, you may be able to see what characters are being sent to the browser before your attempt your redirect.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 孟德尔随机化结果不一致
  • ¥15 深度学习残差模块模型
  • ¥50 怎么判断同步时序逻辑电路和异步时序逻辑电路
  • ¥15 差动电流二次谐波的含量Matlab计算
  • ¥15 Can/caned 总线错误问题,错误显示控制器要发1,结果总线检测到0
  • ¥15 C#如何调用串口数据
  • ¥15 MATLAB与单片机串口通信
  • ¥15 L76k模块的GPS的使用
  • ¥15 请帮我看一看数电项目如何设计
  • ¥23 (标签-bug|关键词-密码错误加密)