TP5二维数组分类重组

上传之前的数组格式listTP5二维数组分类重组

 

foreach($voucherInfo as $key=>$vo){
            $list[] = array_merge($vo,$voucherTypeInfo[$key]);
        }
           
        foreach ($list as $voucher){
            $temp['id'] = $voucher['voucher_id'];
            $temp['title'] = $voucher['title'];
            $temp['price'] = $voucher['price'];
            $temp['jifen'] = ceil(bcdiv(bcmul($voucher['price'],10000),15,2));
            $temp['is_show'] = $voucher['is_show'];
            $temp['icon'] = $voucher['img'];
            $data[$voucher['name']][] = $temp;
        }
        return $data;

重组以后的data数组

TP5二维数组分类重组

 

通过name值对数组重组成多组二维数组