{
meta: {}
notifications: []
response: {}
}
$asObjects = json_decode($json);
foreach ($asObjects as $obj)
{
echo $obj->response->text;
echo "<br>";
}
此方法不起作用,因为response : {}
中的文字如何获取文字?
答案 0 :(得分:2)
看到完整的json后,你需要迭代items数组,然后显示每个项目的文本:
$jsonObj = json_decode($json);
foreach ($jsonObj->response->tips->items as $obj)
{
echo $obj->text;
echo "<br>";
}