php标头已发送错误

2022-01-11 00:00:00 header php

可能重复:
已由 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: ... 	est.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.

谢谢

推荐答案

您可能拥有所谓的 BOM(字节顺序标记)在文件中.根据您使用的编辑器,您需要关闭添加 BOM...

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...

相关文章