我想为每个项目 - > ID
获取 ItemCategory-> id's我怎样才能以最好的方式做到这一点?
以下是JSON数据项的一部分
"6": {
"Item": {
"id": "6",
"name": "test",
"description": "description",
},
"ItemThumbnail": null,
"ItemCategory": {
"3": {
"id": "3",
"name": "name",
"status": "active",
"date_created": "2015-07-07 11:23:52",
"date_updated": "0000-00-00 00:00:00",
},
"4": {
"id": "4",
"name": "name",
"status": "active",
"date_created": "2015-07-07 11:23:52",
"date_updated": "0000-00-00 00:00:00",
}
},
"ItemGroup": []
},
答案 0 :(得分:1)
您可以使用$array = json_decode($str, true);
将json字符串转换为PHP数组,然后循环数组并提取所需的信息。
有关json_decode
的更多详细信息,请参阅http://php.net/manual/en/function.json-decode.php答案 1 :(得分:1)
在json解码后使用它。
foreach($ Item as $ Items)
{
<system.web>