标签:else state size foreach lse info edit 维数 二维数组
$_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; } }
标签:else state size foreach lse info edit 维数 二维数组
原文地址:https://www.cnblogs.com/zjj1990/p/9042364.html