我们知道php中的simplexml没办法直接很方便的添加cdata格式的数据,这样对我们操作时会有一定的问题,下面我来给各位同学介绍php simplexml添加cdata格式数据一种办法,php实例代码如下:
instead ofSite Title * */ class SimpleXMLExtended extends SimpleXMLElement { public function addCData($cdata_text) { $node = dom_import_simplexml($this); $no = $node->ownerDocument; $node->appendChild($no->createCDATASection($cdata_text)); } } $xmlFile = 'config.xml'; // instead of $xml = new SimpleXMLElement(''); $xml = new SimpleXMLExtended(' '); $site = $xml->addChild('site'); // instead of $site->addChild('site', 'Site Title'); $site->title = NULL; // VERY IMPORTANT! We need a node where to append $site->title->addCData('Site Title'); $site->title->addAttribute('lang', 'en'); $xml->asXML($xmlFile);
网奇Eshop商城购物系统:集成国内优秀商城系统的成功元素,采用ASP.NET2.0语言设计开发.傻瓜式的管理模式,强大的后台管理,可添加或定制风格精美的模板,网站广告位任意添加,集成在线支付接口,内置简、繁、英三种语言.系统不断升级,力求尽善尽美.网奇商城的目标是:打造国内最到的商城系统! 升级功能:1.在线备份SQL数据库2.RSS在线订阅器3.整合了支付宝鲜花支付接口。4.整合了网奇E客通在










