【发布时间】:2020-03-16 18:14:20
【问题描述】:
我正在尝试从 PHP 中的 Pixabay API 中获取第一个对象的图像 URL。不幸的是,我的尝试得到了
$encodedjson->hits[0]->largeImageURL
返回一个空字符串。
{
"total": 4692,
"totalHits": 500,
"hits": [
{
"id": 195893,
"pageURL": "https://pixabay.com/en/blossom-bloom-flower-195893/",
"largeImageURL": "https://pixabay.com/get/ed6a99fd0a76647_1280.jpg",
"userImageURL": "https://cdn.pixabay.com/user/2013/11/05/02-10-23-764_250x250.jpg",
},
{
"id": 73424,
...
},
...
]
}
【问题讨论】:
-
你解码了吗???
-
变量名
$encodedjson听起来像是解码前的字符串。