问题描述
完成错误:
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?
编辑:忘记提及,这个问题只发生在我的Mac,我的Windows合作伙伴没有这个问题,重定向适合他。
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.
推荐答案
我知道的两种可能性:
A.关闭PHP标签后,你可能会有一些空格?>
。
Two possibilities I know of:A. You might have some whitespace after the class closing PHP tag ?>
.
B.您正在尝试在处理数据/逻辑期间 echo / pr()
(当它重定向,保存到数据库等时)
B. You are trying to echo/ pr()
during the processing of the data/ logic (-while it's redirecting, saving to the database, etc)
这篇关于CakePHP:无法修改标头信息 - 已经发送的标头的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!