suchen

Heim  >  Fragen und Antworten  >  Hauptteil

Kapselung von Array-Schlüsselwerten!

$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.

Baby颜值男神'WBaby颜值男神'W1246 Tage vor897

Antworte allen(2)Ich werde antworten

  • 致自己

    致自己2021-08-31 10:28:43

    $newArr = [];foreach ($data as $v){    foreach ($v as $kk=>$vv){        $newArr[$kk][]=$vv;    }}

    这种?

    Antwort
    0
  • 猪老湿

    猪老湿2021-08-31 09:42:00

    代码整理一下, 再发, 没格式,看起来太费劲了

    Antwort
    0
  • StornierenAntwort