php创建XML文档出现警告:Input is not proper UTF-8, indicate encoding !

来源:百度知道 编辑:UC知道 时间:2024/06/05 17:32:17
代码:
<?php
$xmlString="<?xml version=\"1.0\" encoding=\"UTF-8\"?>";
$xmlString.="<employee>
<!-- 雇员表 -->
<name EmpType=\"副代表\">
<first>Leverling</first>
<last>Janet</last>
</name>
<name EmpType=\"销售代表\">
<first>郑</first>
<last>安琪</last>
</name>
<name EmpType=\"采购经理\">
<first>赵</first>
<last>晔</last>
</name>
<name EmpType=\"技术联系人\">
<first>王</first>
<last>君如</last>
</name>
<name EmpType=\"技术联系人\">
<first>Buchanan</first>
<last>Steven</last>
</name>
</employee>";
$doc = new DOMDocument("1.0","UTF-8&q

<?xml version=\"1.0\" encoding=\"UTF-8\"?> 可以不用。loadxml是一种对xml进行简单解析的方法。
另外你的loadxml.php以什么方式保存的? 是utf-8 without bom吗?记得不要用ansi的,特别是当你想用utf-8来进行网站设计的时候。可以用记事本打开另存为utf-8