$_data = []; $order_id = ‘‘; foreach ($data as $k => $v) { if($order_id != $v[‘order_id‘]){ $arr = []; $arr[‘id‘] = $v[‘id‘]; $arr[‘order_number‘] = $v[‘order_number‘]; $arr[‘edit_time‘] = $v[‘edit_time‘]; $arr[‘order_state‘] = $v[‘order_state‘]; $arr[‘goods_info‘][] = $v; $_data[] = $arr; $order_id = $v[‘order_id‘]; }else{ $arr = $_data[sizeof($_data)-1]; $arr["goods_info"][] = $v; $_data[sizeof($_data)-1] = $arr; } }
原文地址:https://www.cnblogs.com/zjj1990/p/9042364.html
时间: 2024-11-07 21:09:19