使用SimpleXML实现对XML数据的遍历操作

① 使用for…循环遍历xml数据

② 使用foreach…循环遍历xml数据

③ 使用children方法实现对xml数据的遍历

children方法

public SimpleXMLElement SimpleXMLElement::children() :获取当前元素的所有子节点

运行结果:

打开APP阅读更多精彩内容