Home  >  Q&A  >  body text

thinkphp3.2.3 problem

Excuse me
Array
(

[after_one] => Array
    (
        [0] => 124124
        [1] => 2342
    )

[task_one] => Array
    (
        [0] => 124
        [1] => 41234234
    )

[time_one] => Array
    (
        [0] => 2017-05-19
        [1] => 2017-05-19
    )

[complete_one] => Array
    (
        [0] => 完成途中
        [1] => 未完成
    )

[score_one] => Array
    (
        [0] => 2
        [1] => 2
    )

[reason_one] => Array
    (
        [0] => 124124
        [1] => 124124
    )

[next_one] => Array
    (
        [0] => 412412
    )

[task_two] => Array
    (
        [0] => 12412
    )

[time_two] => Array
    (
        [0] => 2017-05-13
    )

[result_two] => Array
    (
        [0] => 124124
    )

[reason_two] => Array
    (
        [0] => 1231234
    )

)

How to insert this into the database? How to cycle? Here are two pieces of data [0] one [1] one, please help me, thank you
Sorry, please add the database structure now

id after_one task_one time_one complete_one score_one reason_one next_one task_two time_two result_two reason_two
These are field names. Now according to this, there should be two pieces of data. How to insert them into the database?

黄舟黄舟2695 days ago713

reply all(4)I'll reply

  • 天蓬老师

    天蓬老师2017-05-24 11:35:24

    json_encode()

    reply
    0
  • 漂亮男人

    漂亮男人2017-05-24 11:35:24

    Isn’t this possible?

    $beans=array();
    foreach($data as $k=>$v){
     foreach($v as $vK=> $vItem)
     {
         $beans[$vk][$k]=$vItem;
     }
    }
    
    var_dump($beans);

    reply
    0
  • phpcn_u1582

    phpcn_u15822017-05-24 11:35:24

    Just cycle through it yourself.

    .............

    $arr1=array();
    $arr2=array();
    
    for($arr as $k=>$v){
          $arr1[$k]=$arr[$k][0];
          $arr2[$k]=$arr[$k][1];
    }

    reply
    0
  • 高洛峰

    高洛峰2017-05-24 11:35:24

    What is the table structure? How to save?

    reply
    0
  • Cancelreply