lounah Asked:2020-01-07 17:31:28 +0000 UTC2020-01-07 17:31:28 +0000 UTC 2020-01-07 17:31:28 +0000 UTC PHP,从JSON中获取数组元素的数量 772 你好。我有这样的 JSON: { "response":{ "count":10, "items":[], "profiles":[], "groups":[] } } 如何从中获取组中包含的元素个数? php 1 个回答 Voted Best Answer Yuri 2020-01-07T17:45:34Z2020-01-07T17:45:34Z 例如,您可以这样做: $json = '{"response": {"count": 10, "items": [], "profiles": [], "groups": [] } }'; $arr = json_decode($json, true); echo count($arr['response']['groups']);
例如,您可以这样做: