Array
(
    [dictid32] => 32
    [taskid32] => A8
    [user32] => Array
        (
            [0] => 10
            [1] => 9
        )    [sample32_text] => [email protected],[email protected],
    [mailtrue32] => 0
)//这里的数据要写入数据库,格式是: 32 A8 10 0 ,32 A8 9 0Array
(
    [dictid33] => 33
    [taskid33] => A8
    [user33] => Array
        (
            [0] => 1
            [1] => 10
            [2] => 9
         )    [sample33_text] => [email protected],[email protected],[email protected],
    [mailtrue33] => 1
)//这里的数据要写入数据库,格式是: 33 A8 1 1 ,33 A8 10 1,33 A8 9 1
因为这个数组中的key值是变化的,,不会做了,,试了好多种方法,,发现不能行 !!!!!郁闷

解决方案 »

  1.   

    查一下
    $ff=Array
    (
        'dictid33' => 33
        ,'taskid33' => 'A8'
        ,'user33' => Array
    (
                0 => 1
                ,1 => 10
                ,2 => 9
    )    ,'sample33_text'=> '[email protected],[email protected],[email protected],'
        ,'mailtrue33' => '1'
    );
    $i=0;
    $key=split(',','dictid,taskid,user,sample,mailtrue');
    $res=array();
    foreach($ff as $f){ $res[$key[$i]]=$f;
    $i++;
    }
    print_r($res);
      

  2.   

    就是 FOREACH 遍历 查查手册吧