0
내 PHP 코트 반환 오류를 얻을 수 없습니다구문 분석 JSON 값
내가Undefined property: stdClass::$paging in Trying to get property of non-object Use of undefined constant total_items - assumed 'total_items' in
total_items
가치를 얻을 수있는 방법
?
{
"paging": {
"total_items": 0,
"current_page": 1,
"total_pages": 0
},
"data": [],
"facets": null
}
$content = file_get_contents($urll);
$clean_content = removeBomUtf8($content);
$decoded = json_decode($clean_content);
foreach ($decoded->data as $data)
{
$total_items = (string)$data->paging[0]->total_items;
echo total_items;
} ;
빈 배열 인 경우 왜'$ decoded-> data'를 통해 반복 하시겠습니까? 그리고 그 json으로부터'total_items' 값을 얻으려면 루프가없는'$ decoded-> paging-> total_items' 일 것입니다. – ArtOsi