【发布时间】:2019-02-27 20:41:14
【问题描述】:
我是 PHP 新手,我有一个非常基本的问题,但我无法找到答案。这是一个 JSONObject 示例:
{
"biome":"forest",
"id":"51134535488",
"animals":[
{"species":"bear", "age":"8", "gender":"male", "family":"mamal"},
{"species":"hawk", "age":"3", "gender":"female", "family":"bird"},
{"species":"elk", "age":"5", "gender":"male", "family":"mamal"},
{"species":"spider", "age":"0.3", "gender":"female", "family":"insect"}
]
}
在其中,我们有一个 JSONArray,它包含四个 JSONObject。我将如何仅从 JSONObject 获取 JSONArray,然后 foreach 循环它以获取所有内部行?我在流明框架中工作,因此非常感谢特定的流明答案(如果它可以在流明中以不同的方式完成)!
【问题讨论】: