页面含html文本提交处理
<!-- Code highlighting produced by Actipro CodeHighlighter (freeware) http://www.CodeHighlighter.com/ --> //xml局部格式如下 <aa url="www.xxx.com"> <a href="www.xxx.com?x=s&f=3" target="_blank">常 见 问 答1</a><br><br> <font size="13"><a href="www.xxx.com?x=s&f=3" target="_blank">常 见 问 答2</a></font><br><br> <font size="13"><a href="www.xxx.com?x=s&f=3" target="_blank">常 见 问 答3</a></font><br><br> ]]> </aa>
<!-- Code highlighting produced by Actipro CodeHighlighter (freeware) http://www.CodeHighlighter.com/ --> <aa url="www.xxx.com"> </aa>
<aa url="www.xxx.com"> <font size="13"><a href="www.xxx.com?x=s&f=3" target="_blank">常 见 问 答1</a></font><br><br> <font size="13"><a href="www.xxx.com?x=s&f=3" target="_blank">常 见 问 答2</a></font><br><br> <font size="13"><a href="www.xxx.com?x=s&f=3" target="_blank">常 见 问 答3</a></font><br><br> </aa> <br><font color="#e78608">------解决方案--------------------</font><br>之后不要用htmlspecialchars编码 <br><font color="#e78608">------解决方案--------------------</font><br>php.ini中 magic_quotes_gpc()函数是打开的么?自动给引号转义了。。 <br><font color="#e78608">------解决方案--------------------</font><br>用XmlWriter写CDATA数据 <br><font color="#e78608">------解决方案--------------------</font><br> 顺便给你粘过来.
$str = <url> </url> <url> </url> XML; $xml = simplexml_load_string($str,'simpleXMLElement',LIBXML_NOCDATA); header('Content-type: application/xml'); $xw = new XMLWriter(); $xw->openMemory(); $xw->startDocument('1.0','utf-8'); $xw->startElement('root'); foreach ($xml->url as $item){//在循环内修改即可 $xw->startElement('url'); $xw->writeCdata($item.'abc'); $xw->endElement(); } $xw->endElement(); $xw->endElement(); echo $xw->outputMemory(); <div class="clear"> </div>