首先,对不起我的英文。 现在我从.json解析数据,并且遇到了问题,通过使用foreach,我只能解析一次属性数据。 我需要检索src_big
超过1倍迭代json数据php
"src_big":"http:\/\/cs7004.vk.me\/v7004692\/1af45\/QRt-0dPZ8qg.jpg"
"src_big":"http:\/\/cs7004.vk.me\/v7004767\/1ab37\/3M52LmF_dY8.jpg"
例如:
{
"response":[
{
"id":14867,
"from_id":-65923388,
"to_id":-65923388,
"date":1456947602,
"post_type":"post",
"text":"Горячие клавиши Windows 10",
"attachment":{
"type":"photo",
"photo":{
"pid":404384423,
"aid":223686536,
"owner_id":-65923388,
"user_id":100,
"src":"http:\/\/cs7004.vk.me\/v7004692\/1af44\/5zhYes1I7xg.jpg",
"src_big":"http:\/\/cs7004.vk.me\/v7004692\/1af45\/QRt-0dPZ8qg.jpg",
"src_small":"http:\/\/cs7004.vk.me\/v7004692\/1af43\/msvfzwgm5tc.jpg",
"width":604,
"height":302,
"text":"Наука<br>http:\/\/vk.com\/public65923388",
"created":1456235510,
"access_key":"d1cff88abc28e29b28"
}
},
"attachments":[
{
"type":"photo",
"photo":{
"pid":404384423,
"aid":223686536,
"owner_id":-65923388,
"user_id":100,
"src":"http:\/\/cs7004.vk.me\/v7004692\/1af44\/5zhYes1I7xg.jpg",
"src_big":"http:\/\/cs7004.vk.me\/v7004692\/1af45\/QRt-0dPZ8qg.jpg",
"src_small":"http:\/\/cs7004.vk.me\/v7004692\/1af43\/msvfzwgm5tc.jpg",
"width":604,
"height":302,
"text":"Наука<br>http:\/\/vk.com\/public65923388",
"created":1456235510,
"access_key":"d1cff88abc28e29b28"
}
},
{
"type":"photo",
"photo":{
"pid":404384428,
"aid":223686536,
"owner_id":-65923388,
"user_id":100,
"src":"http:\/\/cs7004.vk.me\/v7004365\/1a9ff\/3tEb3pm-bBA.jpg",
"src_big":"http:\/\/cs7004.vk.me\/v7004365\/1aa00\/LIQOncL-su8.jpg",
"src_small":"http:\/\/cs7004.vk.me\/v7004365\/1a9fe\/TKchasZfhNo.jpg",
"width":604,
"height":585,
"text":"Наука<br>http:\/\/vk.com\/public65923388",
"created":1456235512,
"access_key":"e9370296ef33bebb7a"
}
},
{
"type":"photo",
"photo":{
"pid":404384439,
"aid":223686536,
"owner_id":-65923388,
"user_id":100,
"src":"http:\/\/cs7004.vk.me\/v7004767\/1ab36\/1IqODh-OmS0.jpg",
"src_big":"http:\/\/cs7004.vk.me\/v7004767\/1ab37\/3M52LmF_dY8.jpg",
"src_small":"http:\/\/cs7004.vk.me\/v7004767\/1ab35\/lOR1yvNeE8Y.jpg",
"width":478,
"height":604,
"text":"Наука<br>http:\/\/vk.com\/public65923388",
"created":1456235514,
"access_key":"8cc1048e72e29b8ced"
}
},
{
"type":"photo",
"photo":{
"pid":404384504,
"aid":223686536,
"owner_id":-65923388,
"user_id":100,
"src":"http:\/\/cs7004.vk.me\/v7004474\/1b385\/wdi9GlRth20.jpg",
"src_big":"http:\/\/cs7004.vk.me\/v7004474\/1b386\/I5PY-gN_xa4.jpg",
"src_small":"http:\/\/cs7004.vk.me\/v7004474\/1b384\/HkzVl-hsZUo.jpg",
"width":604,
"height":419,
"text":"Наука<br>http:\/\/vk.com\/public65923388",
"created":1456235537,
"access_key":"5d5ca96b04e91e2744"
}
},
{
"type":"photo",
"photo":{
"pid":404384509,
"aid":223686536,
"owner_id":-65923388,
"user_id":100,
"src":"http:\/\/cs7004.vk.me\/v7004452\/1a619\/nDL7Q9dJhxs.jpg",
"src_big":"http:\/\/cs7004.vk.me\/v7004452\/1a61a\/PaJXcLeD5Aw.jpg",
"src_small":"http:\/\/cs7004.vk.me\/v7004452\/1a618\/-h36pYEcpPY.jpg",
"width":604,
"height":292,
"text":"Наука<br>http:\/\/vk.com\/public65923388",
"created":1456235540,
"access_key":"ae318183e5303414e9"
}
}
],
"comments":{
"count":0
},
"likes":{
"count":127
},
"reposts":{
"count":45
}
}
]
}
你如何使用json_decode?你是基于json创建一个数组还是将它用作stdclass? – Tyr
$ records = json_decode($ records_json,true); – ATIKON