Php 使用domdocumentissue生成XML

Php 使用domdocumentissue生成XML,php,ajax,xml,domdocument,php-5.6,Php,Ajax,Xml,Domdocument,Php 5.6,我目前正在尝试使用PHP和DOMDocument类生成XML //创建xml“ServiceProfile” $xmlServiceProfile=新的DOMDocument('1.0','utf-8'); $xmlServiceProfile->formatOutput=true; $root=$xmlServiceProfile->createElement('******'); $serveur=$xmlServiceProfile->createElement('******',cree

我目前正在尝试使用PHP和DOMDocument类生成XML

//创建xml“ServiceProfile”
$xmlServiceProfile=新的DOMDocument('1.0','utf-8');
$xmlServiceProfile->formatOutput=true;
$root=$xmlServiceProfile->createElement('******');
$serveur=$xmlServiceProfile->createElement('******',creeServeurLong(****);
$archive=$xmlServiceProfile->createElement(“*******”,“*******”);
$taskList=$xmlServiceProfile->createElement('*****');
foreach($key=>$value的数组){
$task=$xmlServiceProfile->createElement($key,$value);
$taskList->appendChild($task);
}
//添加节点
$root->appendChild($*****);
$root->appendChild($*****);
$root->appendChild($*****);
$xmlServiceProfile->appendChild($root);
echo$xmlServiceProfile->saveXML();
我有一个错误,这意味着XML生成失败,但我的http响应中有一个很好的XML

我在一个网站上查看了XML,得到了

65279;
我已经尝试过:

将文档更改为不带BOM的UTF-8,不工作

DOMDocument::saveXML()上添加
trim()
函数

DOMDocument::saveXML()上添加
htmlspecialchar()
函数


有人帮忙吗

为什么不使用或?这两个工具都是PHP内置的强大的XML解析工具,默认情况下是启用的。事实上,我在google research之前和之后都没有这样做过,这种方式在我自己的语言中被记录得最多。^^也许这个问题可能会有所帮助:。不知怎的,那个怪物正偷偷溜进去。它可能与您的文本编辑器有关。因为它是一个零宽度的空间,所以很难发现。谢谢,我已经看过了,但它对我的案例不起作用。为什么不使用或?这两个工具都是PHP内置的强大的XML解析工具,默认情况下是启用的。事实上,我在google research之前和之后都没有这样做过,这种方式在我自己的语言中被记录得最多。^^也许这个问题可能会有所帮助:。不知怎的,那个怪物正偷偷溜进去。它可能与您的文本编辑器有关。因为它是一个零宽度的空间,所以很难发现。谢谢,我已经看过了,但它不适用于我的案例,可能是重复的