CakePHP: Cannot modify header information - headers already sent by [duplicate]

让人想犯罪 __ 提交于 2019-12-22 01:03:03

问题


Complete error:

Warning (2): Cannot modify header information - headers already sent by (output started at /Applications/XAMPP/xamppfiles/htdocs/trunk/dafe/cake/basics.php:355) [CORE/cake/libs/controller/controller.php, line 743]

As far as I can tell it happens after I try to redirect. I know it's caused by a whitespace but I can't find it anywhere, where does this error tend to be?

EDIT: Forgot to mention, this problem only happens on my Mac, my partner working on windows does not have this issue, redirection works appropriately for him.


回答1:


Two possibilities I know of: A. You might have some whitespace after the class closing PHP tag ?>.

B. You are trying to echo/ pr() during the processing of the data/ logic (-while it's redirecting, saving to the database, etc)




回答2:


I had this Problem recently myself and searched for Blanks within my Code but didnt't find one. The simple Solution: Deactivated the debug mode (Configure::write(debug,0) and everything worked fine :)




回答3:


I had a similar problem and tried removing white space, flush, etc... but nothing worked until I configured output_buffering to 'on' in my EZ php config interface on cpanel.



来源:https://stackoverflow.com/questions/6756621/cakephp-cannot-modify-header-information-headers-already-sent-by

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!