我有一个运行良好的网站。第一页是 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 开始的地方。