1.foreach循环追加修改
foreach ($res as $k => $v) { $res[$k]['time'] = date('Y-M-D',$v['time']); }
2.循环引用追加修改
foreach ($res as $k => &$v) { $v['time'] = date('Y-M-D',$v['time']); }
3.使用array_walk追加修改
array_walk($res,function (&$v) { $v['time'] = date('Y-M-D',$v['time']);//方式1 $v = array_merge($v,['time'=>date('Y-M-D',$v['time'])]);//方式二 });