可能重复:
PHP Fix Warning: Cannot modify header information - headers already sent
“Warning: Headers already sent” in PHP如何解决'警告:无法修改标题信息'错误?
我有一个不错的网站,非常完美。第一页是header.php文件,第一行是:
<?xml version="1.0" encoding="utf-8"?>
有一天我开始说语法错误行1。所以我做了网络上的一些研究,改变了第一行到这一点:
<?php echo '<?xml version="1.0" encoding="utf-8"?>' ?>
解析错误问题消失了。但随后另一个问题出现了:
Warning: Cannot modify header information - headers already sent by (output started at /Volumes/raid/Web/Sites/*******.com/header.php:1)
所以我决定从代码中删除这个第一行(和说实话,我不知道什么是它的目的)。然后,一个新的错误出现:
Warning: Cannot modify header information - headers already sent by (output started at /Volumes/raid/Web/Sites/*******.com/header.php:25)
这里的地方我找不到任何错误代码(在行尾没有空格,肯定)
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1 /DTD/xhtml1-transitional.dtd">
<html lang="fr" dir="ltr" xml:lang="fr" xmlns="http://www.w3.org/1999/xhtml">
<head>
<link href="/css/bootstrap.css" rel="stylesheet">
<link href="/css/style.css" rel="stylesheet">
<link type="image/x-icon" href="./img/lions_icon" rel="icon">
<link type="image/x-icon" href="./img/lions_icon" rel="shortcut icon">
<link href="/css/jquery.ui.all.css" rel="stylesheet">
<title>Lions</title>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
<script src="/js/jquery.js"></script>
<script src="/js/jquery-1.8.2.js"></script>
<script src="/js/jquery.ui.core.js"></script>
<script src="/js/jquery.ui.widget.js"></script>
<script src="/js/jquery.ui.datepicker.js"></script>
<script src="/js/bootstrap.js"></script>
<script>
$(function() {
$("#date").datepicker();
$("#date").datepicker("option", "dateFormat", "yy-mm-dd");
});
</script>
</head>
<?php
// beggining of the php code,
....
?>
<body>
...
线25是一个地方PHP开始。
这件事是我不输出任何东西之前的头()和错误说输出发生25行或1行,如果我保持我的第一行(你可以看到在线程中)。 –