如何从地球上获取id和此数组中的名称(可能使用ForEach结构)?
stdClass Object (
[data] => Array (
[0] => stdClass Object ( [name] => Corinne Culbard [id] => 5005561918 )
[1] => stdClass Object ( [name] => Tom West [id] => 5034297044 )
[2] => stdClass Object ( [name] => Sabri Tasci [id] => 5057373639 )
答案 0 :(得分:3)
这不起作用吗?
foreach ($object->data as $item) {
$name = $item->name;
$id = $item->id;
}