How Codeigniter converts xml into objects through SimpleXML
This article mainly introduces Codeigniter's method of converting xml into objects through SimpleXML, which involves the skills of Codeigniter in operating XML files and is very useful. For more information, see
This example describes how Codeigniter converts xml into an object through SimpleXML. Share it with you for your reference. The specific analysis is as follows:
SimpleXML is a php extension that can be used to easily operate xml files.
?
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; } } |
I hope this article will help you design your php program based on the Codeigniter framework.