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 如何获取烟草零售终端数据
  • ¥15 数学建模招标中位数问题
  • ¥15 phython路径名过长报错 不知道什么问题
  • ¥15 深度学习中模型转换该怎么实现
  • ¥15 HLs设计手写数字识别程序编译通不过
  • ¥15 Stata外部命令安装问题求帮助!
  • ¥15 从键盘随机输入A-H中的一串字符串,用七段数码管方法进行绘制。提交代码及运行截图。
  • ¥15 TYPCE母转母,插入认方向
  • ¥15 如何用python向钉钉机器人发送可以放大的图片?