PHP头文件已经发送错误 [英] php headers already sent error
问题描述
可能存在重复:
已由PHP发送的头文件
我有一个php文件,这个代码在里面:
I have a single php file, with this code in it:
<?php header("Location: somepage.php"); ?>
在php打开或关闭标记之前或之后绝对没有空格,我得到
Absolutely no spaces before or after the php opening or closing tags and I am getting the
Warning: Cannot modify header information - headers already sent by (output started at C:\ ... \test.php:1
通常当我得到这个错误时,1是问题的行号,但在这种情况下,行我没有任何额外的空格,我只有这个代码在页面上,我没有包含任何其他文件。
Usually when I get this error, the 1 is the line number of the problem, but in this case line one doesn't have any extra whitespace. I only have this code on the page and I am not including any other files.
我在Windows XP上使用xampp。任何想法正在发生什么,或者我如何能够找出真正导致问题的原因。
I'm using xampp on windows xp. Any ideas what's going on or how I can track down what's really causing the problem.
谢谢
Thanks
推荐答案
很可能你有什么被称为 BOM(字节顺序标记) a>,根据你使用的编辑器,你需要关闭添加物料清单......
Chances are that you have what's known as a BOM (Byte Order Mark) in the file. Depending on what editor you're using, you'll need to turn off adding the BOM...
这篇关于PHP头文件已经发送错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!