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


    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格式的,改一下,问题就解决了。

  • 相关阅读:
    tableau用户留存分析
    tableau用户分类
    业务
    数据分析的思维技巧-二
    数据分析的思维技巧
    业务化思维
    公式化思维
    结构化思维
    Shortest Unsorted Continuous Subarray
    Longest Harmonious Subsequence
  • 原文地址:https://www.cnblogs.com/lrxing/p/3580358.html
Copyright © 2020-2023  润新知