我见过类似的问题,但没有一个成功回答。我有这个 simpleXMLElement 转数组:
Array
(
[0] => SimpleXMLElement Object
(
[@attributes] => Array
(
[uri] => https://66.90.34.19:9630/api/users/2/
[id] => 2
[full_render] => true
)
[username] => Admin
[password] => SimpleXMLElement Object
(
)
[name] => SimpleXMLElement Object
(
[first] => LightSpeed
[last] => Administrator
)
[email] => SimpleXMLElement Object
(
)
[account_locked] => false
[privilege_group] => SimpleXMLElement Object
(
[@attributes] => Array
(
[uri] => https://66.90.34.19:9630/api/privilege_groups/0/
[id] => 0
[full_render] => false
)
[name] => Administrator
[type] => administrator
)
[read_eula] => true
[hidden] => false
[enabled] => true
[phone] => SimpleXMLElement Object
(
)
[product] => SimpleXMLElement Object
(
)
[product_code] => SimpleXMLElement Object
(
)
[open_to_pos] => false
[gsx_tech_id] => SimpleXMLElement Object
(
)
[can_open_from_otr] => true
[can_discount] => true
[internal_user] => false
[active] => true
[expired] => false
)
[1] => SimpleXMLElement Object
(
[@attributes] => Array
(
[uri] => https://66.90.34.19:9630/api/users/2/
[id] => 2
[full_render] => true
)
[username] => Admin
[password] => SimpleXMLElement Object
(
)
[name] => SimpleXMLElement Object
(
[first] => LightSpeed
[last] => Administrator
)
[email] => SimpleXMLElement Object
(
)
[account_locked] => false
[privilege_group] => SimpleXMLElement Object
(
[@attributes] => Array
(
[uri] => https://66.90.34.19:9630/api/privilege_groups/0/
[id] => 0
[full_render] => false
)
[name] => Administrator
[type] => administrator
)
[read_eula] => true
[hidden] => false
[enabled] => true
[phone] => SimpleXMLElement Object
(
)
[product] => SimpleXMLElement Object
(
)
[product_code] => SimpleXMLElement Object
(
)
[open_to_pos] => false
[gsx_tech_id] => SimpleXMLElement Object
(
)
[can_open_from_otr] => true
[can_discount] => true
[internal_user] => false
[active] => true
[expired] => false
)
我想要回显 [name]->[first] 和 [name]->[last]。
我尝试了许多版本的循环来通过键名获取它们。我就是想不通。请帮忙!