>  기사  >  php教程  >  Codeigniter通过SimpleXML将xml转换成对象的方法

Codeigniter通过SimpleXML将xml转换成对象的方法

WBOY
WBOY원래의
2016-06-13 09:10:561337검색

Codeigniter通过SimpleXML将xml转换成对象的方法

 这篇文章主要介绍了Codeigniter通过SimpleXML将xml转换成对象的方法,涉及Codeigniter操作XML文件的技巧,非常具有实用价值,需要的朋友可以参考下

 

 

本文实例讲述了Codeigniter通过SimpleXML将xml转换成对象的方法。分享给大家供大家参考。具体分析如下:

SimpleXML是一个php扩展,有了它可以非常容易的操作xml文件

?

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

class CI_ManipulateXML

{

var $xml='';

function CI_ManipulateXML($xmlcontent)

{

$this->xml=$xmlcontent;

}

function ConvertXML() {

try {

$xmlobject = new SimpleXMLElement($this->xml);

if ($xmlobject == false) {

return false;

}

}

catch (Exception $e) {

return false;

}

return $xmlobject;

}

}

希望本文所述对大家的基于Codeigniter框架的php程序设计有所帮助。

성명:
본 글의 내용은 네티즌들의 자발적인 기여로 작성되었으며, 저작권은 원저작자에게 있습니다. 본 사이트는 이에 상응하는 법적 책임을 지지 않습니다. 표절이나 침해가 의심되는 콘텐츠를 발견한 경우 admin@php.cn으로 문의하세요.