日期:2014-05-17  浏览次数:20489 次

生成XML,字符转义
$doc1=new DOMDocument("1.0","utf-8");
$doc1->formatOutput=true;
$document=$doc1->createElement("document");
$document=$doc1->appendChild($document);
$webname=$doc1->createElement("webname");
$webname=$document->appendChild($webname);
$webname->appendChild($doc1->createTextNode(xmlencode('<![CDATA[ test ]]>')));
生成的xml是<document>
<webname>&lt;![CDATA[ test ]]&gt;</webname>
我不想把<>这个转义,应该怎么处理一下,各们帮帮忙吧

------解决方案--------------------
xml有个createCDATASection
不需要你使用这个方式