php headers already sent error(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标头已发送错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:php标头已发送错误


- 没有作曲家的 PSR4 自动加载 2022-01-01
- PHP Count 布尔数组中真值的数量 2021-01-01
- SoapClient 设置自定义 HTTP Header 2021-01-01
- 从 PHP 中的输入表单获取日期 2022-01-01
- 正确分离 PHP 中的逻辑/样式 2021-01-01
- Mod使用GET变量将子域重写为PHP 2021-01-01
- 如何定位 php.ini 文件 (xampp) 2022-01-01
- Laravel 仓库 2022-01-01
- Oracle 即时客户端 DYLD_LIBRARY_PATH 错误 2022-01-01
- 带有通配符的 Laravel 验证器 2021-01-01