Home >Backend Development >PHP Tutorial >Codeigniter's method of converting xml into objects through SimpleXML_PHP tutorial
This article mainly introduces Codeigniter's method of converting xml into objects through SimpleXML, and involves Codeigniter's skills in operating XML files. It is of great practical value, friends in need can refer to it
The example in this article describes how Codeigniter converts xml into objects through SimpleXML. Share it with everyone for your reference. The specific analysis is as follows:
SimpleXML is a php extension, with which you can operate xml files very easily
?
3 4 513 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; } } |