首页 > 其他 > 详细

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

时间:2014-03-05 01:44:27      阅读:1033      评论:0      收藏:0      [点我收藏+]

This page contains the following errors:

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

Below is a rendering of the page up to the first error.

--------------------------------------------------------------------------------------------------

今天调试接口的时候又发现了这个东西,在Google上找来几篇stackoverflow的帖子,总算是解决了。一般出现这种情况的时候

首先应该注意的是在“Header(‘Content-type: text/xml‘);”前不要有其他输出,最好将“Header(‘Content-type: text/xml‘);”放在文件的最顶端;

然后检查一下是不是真的像它说的那样在输出的第一行有空行;

最后就是检查你的编码是不是BOM格式的,如果是的话,改成无BOM格式的试试。

什么是BOM,其实我也不太明白,所以就百度了一下:

UTF-8 BOM又叫UTF-8 签名,其实UTF-8 的BOM对UFT-8没有作用,是为了支援UTF-16,UTF-32才加上的BOM,BOM签名的意思就是告诉编辑器当前文件采用何种编码,方便编辑器识别,
但是BOM虽然在编辑器中不显示,但是会产生输出,就像多了一个空行。

我的问题就在于不应该是用BOM格式的,改一下,问题就解决了。

error on line 1 at column 6: XML declaration allowed only at the start of the document,布布扣,bubuko.com

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

原文:http://www.cnblogs.com/lrxing/p/3580358.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!