日期:2014-05-17 浏览次数:20548 次
{
"code":"A0001",
"serverTime":12345,
"data":[
{"epgId":"1103226854","endTime":"12000"},
{"epgId":"1103226855","endTime":"12300"},
{"epgId":"1103226857","endTime":"12350"},
{"epgId":"1103226858","endTime":"12356"}
]
}
$s='{
"code":"A0001",
"serverTime":12345,
"data":[
{"epgId":"1103226854","endTime":"12000"},
{"epgId":"1103226855","endTime":"12300"},
{"epgId":"1103226857","endTime":"12350"},
{"epgId":"1103226858","endTime":"12356"}
]
}';
$arr=json_decode($s,true);
foreach($arr['data'] as $v){
if($v['endTime']>$arr['serverTime']){
echo $v['epgId'];
break;
}
}