dongqi7631 2011-02-14 17:49
浏览 15

rss页面开头的额外空间

Recently I faced with an abnormal thing in my website's RSS.

There is an extra space character in the begining of rss page source and browsers can't show it because of bellow error :

error on line 1 at column 6: XML declaration allowed only at the start of the document

My code is simple and im using in other websites without a problem

echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>
";
echo "<rss version=\"2.0\" 
";
echo "  xmlns:dc=\"http://purl.org/dc/elements/1.1/\"
";
echo "  xmlns:sy=\"http://purl.org/rss/1.0/modules/syndication/\"
";
echo "  xmlns:admin=\"http://webns.net/mvcb/\"
";
echo "  xmlns:rdf=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\" >

";
echo "<channel>
";
echo "<title>".htmlspecialchars($sitename)."</title>
";
echo "<link>".htmlspecialchars($url)."</link>
";
echo "<description>".$slogan."</description>
";
echo "<dc:language>".$backend_language."</dc:language>
";
echo "<dc:creator>".$adminmail."</dc:creator>
";
echo "<dc:date>".$now."</dc:date>

";
echo "<sy:updatePeriod>hourly</sy:updatePeriod>
";
echo "<sy:updateFrequency>1</sy:updateFrequency>
";
echo "<sy:updateBase>".$now."</sy:updateBase>

";

and the outcome is this :

    <?xml version="1.0" encoding="utf-8"?> 
<rss version="2.0" 
  xmlns:dc="http://purl.org/dc/elements/1.1/"
  xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
  xmlns:admin="http://webns.net/mvcb/"
  xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"> 
<channel> 

As you can see before

what should i do to solve this problem !?

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 mmocr的训练错误,结果全为0
    • ¥15 python的qt5界面
    • ¥15 无线电能传输系统MATLAB仿真问题
    • ¥50 如何用脚本实现输入法的热键设置
    • ¥20 我想使用一些网络协议或者部分协议也行,主要想实现类似于traceroute的一定步长内的路由拓扑功能
    • ¥30 深度学习,前后端连接
    • ¥15 孟德尔随机化结果不一致
    • ¥15 apm2.8飞控罗盘bad health,加速度计校准失败
    • ¥15 求解O-S方程的特征值问题给出边界层布拉休斯平行流的中性曲线
    • ¥15 谁有desed数据集呀