我有这个
$xml = new SimpleXMLElement($output);
$names = $xml->param->value->array->data;
这是输出
SimpleXMLElement Object
(
[value] => Array
(
[0] => SimpleXMLElement Object
(
[struct] => SimpleXMLElement Object
(
[member] => SimpleXMLElement Object
(
[name] => school
[value] => SimpleXMLElement Object
(
[struct] => SimpleXMLElement Object
(
[member] => Array
(
[0] => SimpleXMLElement Object
(
[name] => schoolid
[value] => SimpleXMLElement Object
(
[string] => 49961
)
)
[1] => SimpleXMLElement Object
(
[name] => schoolname
[value] => SimpleXMLElement Object
(
[string] => Millersville Elementary School
)
)
我正在尝试获取“学校名称”值
使用
for($i=0;$i<count($names);$i++) {
echo $names[0][$i]->struct->member->value->struct->member[0]->value.'<br>';
}
我也试过 string($names[0]etc.) 没有成功。我想我一开始就用 $names[0][$i] 搞乱了顺序??
任何帮助深表感谢!