所以,我有以下代碼:count次X出現在JSON
{
"request": {
"data_start": "2013-01-01",
"data_end": "2014-06-13"
},
"response": {
"status": 1,
"httpStatus": 200,
"data": {
"data": [{
"Stat": {
"offer_id": "8",
"clicks": "0",
"date": "2013-01-14",
"month": "01",
"year": "2013",
"affiliate_id": "1000"
}
}, {
"Stat": {
"offer_id": "8",
"clicks": "26",
"date": "2013-02-06",
"month": "02",
"year": "2013",
"affiliate_id": "1000"
}
}, {
"Stat": {
"offer_id": "8",
"clicks": "12",
"date": "2013-02-06",
"month": "02",
"year": "2013",
"affiliate_id": "2"
}
}
}]
}
}
}
我需要知道有多少次「約會」:「2013年2月6日」,例如出現在此JSON,使用PHP。這可能嗎?只是要清楚,這只是一個例子,實際的JSON數千行。
謝謝!
你有它作爲一個PHP對象或字符串? – Prashant
另外,你的JSON對象似乎很糟糕。檢查jslint.com首先更正您的JSON並編輯問題以重新發布有效的JSON – Prashant
您對字符串嘗試了'json_decode()',然後遍歷數據數組? –