我在参加过的所有演唱会上都做了一个循环,有些演唱会有相同的歌曲。
下面是该数组的结果:http://snippi.com/s/k80v7pe
现在,我想拥有一个包含所有不同歌曲id的数组。因此,我想查看我听过的所有歌曲:
//get the songs field get_field(\'songs\')
foreach ($postIds as $postId){
array_push($songIds, get_field(\'songs\', $postId));
}
//Over here I\'m trying to print all the ID\'s of the song
foreach ($songIds as $songId) {
echo $songId->ID;
}
但我得到以下错误:注意:正在尝试获取中非对象的属性“ID”
就是因为这个数组$songIds
数组中是否有数组?