我想抓住特定日期的所有事件。 我有一个事件结果:
{
"response": {
"2014-12-13": [
{
"id": "16",
"event_name": "testing",
"image": "images/Penguins.jpg",
"event_date": "2014-12-13",
"event_time": "02:10",
"time_interval": "4",
"location": "mohali",
"event_type": "Rock",
"detail": "sfdsf fgf ghb\t",
"delivery": "dggh fghgfh\t\t",
"status": "1"
}
],
"2014-12-18": [
{
"id": "15",
"event_name": "hello",
"image": "images/Desert.jpg",
"event_date": "2014-12-18",
"event_time": "02:10",
"time_interval": "11",
"location": "sss",
"event_type": "Simple",
"detail": "dss sd\t\t",
"delivery": "asds sffs\t\t",
"status": "1"
},
{
"id": "14",
"event_name": "dd",
"image": "images/Tulips.jpg",
"event_date": "2014-12-18",
"event_time": "01:00",
"time_interval": "sd",
"location": "wed",
"event_type": "Simple",
"detail": "wdd\t\t\t",
"delivery": "jbd\t\t\t",
"status": "1"
}
]
}
}
我需要什么,我想用相同的密钥捕获每个日期以在IOS Web服务中捕获这些日期事件,LIKE
"event_date" :"2014-12-18": [ //this date have two result
"event_date" :"2014-12-13": [ //this date have oneresult
我试过这段代码:
if(array_key_exists($data['event_date'],$sortArray))
{
$sortArray['response'][$data['event_date']][]=$data;
}
else
{
$sortArray['response'][$data['event_date']][]=$data;
}
那我该怎样做才能实现呢?
提前致谢