【发布时间】:2013-02-22 20:53:50
【问题描述】:
<?php
// Display the error message according to each data code.
$xml = '<?xml version="1.0" encoding="utf-8"?><results>';
if($_GET['code'] == "500"){
$xml .= '<error id="500" message="Error 500"></error>';
}else if($_GET['code'] == "501"){
$xml .= '<error id="501" message="Error 501"></error>';
}
$xml .= '</results>';
header ("Content-Type:text/xml");
echo ($xml);
?>
我收到了这个错误
This page contains the following errors:
error on line 3 at column 1: Extra content at the end of the document
Below is a rendering of the page up to the first error.
明文形式
<?xml version="1.0" encoding="UTF-8"?><results><error id="501" message="Invalid Course Code"></error> </results>
<!-- Hosting24 Analytics Code -->
<script type="text/javascript" src="http://stats.hosting24.com/count.php"></script>
<!-- End Of Analytics Code -->
【问题讨论】:
-
您是否尝试在结果开始标记前换行?
-
结果前换行是什么意思?
-
?>
PHP 结束标记后没有多余的空格吗? -
能否显示浏览器错误报告的其余部分?
-
或者更好的是完整的 XML 结果。