我打算从 xml 文件中获取一些特定的数据。我曾经simple_load_file()
加载一个xml文件并获取对象元素,但我不知道如何访问它们。xml 文件如下所示:
<?mxl version="1.0">
<metaData>
<Application version="1.0" type="32">
<options>
<section name="A">
<description>...</description>
...
<section name="B">
....
</options>
</Application>
</metaData>
我的代码:
$xml = simplexml_load_file($url);
echo $xml->Application->version; // get the version but failed
echo $xml->Application->options->section...//I want to get the data from each section, but I don't know how to visit the elements.