$data = array( ['subject'=>'Low Section Chinese','one_name'=>'Writing Volume','two_name'=>'Ancient Poetry No. 1','title'=> '11111'], ['subject'=>'Low section Chinese','one_name'=>'Writing volume','two_name'=>'Alte Poesie Nr. 1','title'=>' 22222'], ['subject'=>'Low section Chinese','one_name'=>'Test paper','two_name'=>'Old Poetry No. 2','title'=>'666666 '], ['subject'=>'Low Section Mathematics','one_name'=>'Exercise Paper','two_name'=>'Low Section Mathematics 1','title'=>'333333'] , ['subject'=>'Low Section Mathematics','one_name'=>'Exercise Paper','two_name'=>'Low Section Mathematics 2','title'=>'444444'], [ 'subject'=>'Low Section Mathematics','one_name'=>'Evaluation Paper','two_name'=>'Low Section Mathematics 1','title'=>'777777'], ['subject '=>'Fortgeschrittenes Chinesisch','one_name'=>'Gemälderolle','two_name'=>'Gemälde 1','title'=>'555555'], );
Denken Sie zuerst Drücken Sie „subject“, um es zu kapseln, dann „one_name“ unten und „two_name“, um es Schicht für Schicht zu kapseln.
$newArr = [];foreach ($data as $v){ foreach ($v as $kk=>$vv){ $newArr[$kk][]=$vv; }}
这种?
代码整理一下, 再发, 没格式,看起来太费劲了