我最近在新服务器上设置了 apache 和 php,但是我在旧服务器上呈现 xml 的 php 代码没有在下面的新服务器上呈现错误显示。请有人帮助我:
XML Parsing Error: XML or text declaration not at start of entity
Location: `http://192.168.1.200/file.php`
Line Number 4, Column 1:<?xml version = "1.0" ?><rows><row id = '85'><cell> </cell><cell> 85 </cell><cell image='folder.gif'> 55 </cell><cell> 61 </cell><cell> 2013-07-27 14:29:15 </cell><cell> ndegwa22@googlemail.com </cell><cell> salland@nts.nl </cell>
^
我的代码
<?php
require("config.php");
header("Content-type:text/xml");
echo "<?xml version = \"1.0\" ?>";
echo "<rows>";
$qry = "SELECT * FROM tickets WHERE parent_id = 0 ORDER BY message_id DESC";
$res = mysql_query($qry) or die(mysql_error().$qry);
while ($row = mysql_fetch_array($res))
{
echo "<row id = '{$row["id"]}'>";
echo "<cell> {$row["id"]} </cell>";
echo "<cell image='folder.gif'> {$row["ticket_id"]} </cell>";
echo "<cell> {$row["message_id"]} </cell>";
echo "<cell> {$row["date_time"]} </cell>";
echo "<cell> {$row["from_email"]} </cell>";
echo "<cell> {$row["to_email"]} </cell>";
echo "<cell> ".xmlEscape($row["subject"])." </cell>";
echo "<cell><![CDATA[";
$ar = explode(";",$row["attachment"]);
foreach($ar as $key=>$value)
{
echo "<a target='_blank' href='Mail/attachments/{$value}'>{$value} </a> ";
}
echo "]]></cell>";
echo "<cell> {$row["eid"]}</cell>";
echo "<cell> {$row["email_status"]}</cell>";
echo "<cell> {$row["ticket_status"]}</cell>";
echo "<cell> {$row["entry_datetime"]}</cell>";
getChildMailXml($row["id"]);
echo "</row>";
}
echo "</rows>";
?>