如果我不知道“pageid”,如何访问“thumburl”?
{
"continue": {
"iistart": "2004-12-19T12:37:26Z",
"continue": "||"
},
"query": {
"pages": {
"30260": {
"pageid": 30260,
"ns": 6,
"title": "File:Japanese diet inside.jpg",
"imagerepository": "local",
"imageinfo": [
{
"thumburl": "https://upload.wikimedia.org/wikipedia/commons/thumb/e/e1/Japanese_diet_inside.jpg/130px-Japanese_diet_inside.jpg",
"thumbwidth": 130,
"thumbheight": 95,
"url": "https://upload.wikimedia.org/wikipedia/commons/e/e1/Japanese_diet_inside.jpg",
"descriptionurl": "https://commons.wikimedia.org/wiki/File:Japanese_diet_inside.jpg",
"descriptionshorturl": "https://commons.wikimedia.org/w/index.php?curid=30260"
}
]
}
}
}
}
在PHP中的多个对象我可以做这个imageinfo[0]
但是如果我把$imageurl = $data->query->pages[0]->imageinfo[0]->thumburl;
它不工作,因为它是一个对象而不是一个数组。
我怎样才能做到这一点?