php标头已发送错误 [英] php headers already sent error

查看:23
本文介绍了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...

这篇关于php标头已发送错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆