【发布时间】:2019-09-24 02:47:30
【问题描述】:
我有一个$xml,看起来像这样
SimpleXMLElement Object
(
[@attributes] => Array
(
[Total] => 450
[Count] => 4
[Start] => 0
)
[Code] => 0
[Item] => Array
(
[0] => SimpleXMLElement Object
(
[Person.P_Id] => 14845
)
[1] => SimpleXMLElement Object
(
[Person.P_Id] => 14844
)
[2] => SimpleXMLElement Object
(
[Person.P_Id] => 14837
)
[3] => SimpleXMLElement Object
(
[Person.P_Id] => 14836
)
)
)
现在我想让数组Item 与另一个数组合并,但是当我尝试$xml->Item 时,我只得到了这个数组的第一个元素(即14845)。当我使用count($xml->Item) 时,它返回真值(即 4)。我是不是做错了什么来获取整个数组Item?
【问题讨论】:
-
你需要迭代
->Item,代码在哪里?您忘记在帖子中添加它们