I use following PHP code to read a XML file, but it only display word "string" on the page. what's wrong with these codes, do I need define subchild? and how to do that, a new PHP guy, need your help, thanks. PHP code: test XML file:
$xml->children() will only get you the first "layer" of children. You need to insert further loops for each "sublayer", ie the node with its children or call the function recursively. Take a look at this example, http://www.php.net/manual/en/function.simplexml-element-children.php#75311 and at the general description for simplexmlelement->children function, it's explained there, that you need a loop for each "generation" of children for specific node: http://www.php.net/manual/en/function.simplexml-element-children.php