本帖最后由 gsx31 于 2011-12-18 00:45:56 编辑

解决方案 »

  1.   

    这还不简单。foreach一次用你想不重复的数据当key。
      

  2.   

    $data = Array
    (
        '0' => Array
            (
                '0' => Array
                    (
                        'node_id' => 4,
                        'node_pid' => 0,
                    ),            '1' => Array
                    (
                        'node_id' => 1,
                        'node_pid' => 0,
                    ),            '2' => Array
                    (
                        'node_id' => 8,
                        'node_pid' => 4,
                    ),            '3' => Array
                    (
                        'node_id' => 3,
                        'node_pid' => 1,
                    ),        ),    '1' => Array
            (
                '0' => Array
                    (
                        'node_id' => 4,
                        'node_pid' => 0,
                    ),            '1' => Array
                    (
                        'node_id' => 1,
                        'node_pid' => 0,
                    ),            '2' => Array
                    (
                        'node_id' => 9,
                        'node_pid' => 4,
                    ),            '3' => Array
                    (
                        'node_id' => 5,
                        'node_pid' => 4,
                    ),            '4' => Array
                    (
                        'node_id' => 2,
                        'node_pid' => 1,
                    ),        ),);$t = call_user_func_array('array_merge', $data);
    print_r( array_multi_unique($t) );function array_multi_unique($ar) {
      $ar = array_map('serialize', $ar);
      $ar = array_unique($ar);
      return array_map('unserialize', $ar);
    }Array
    (
        [0] => Array
            (
                [node_id] => 4
                [node_pid] => 0
            )    [1] => Array
            (
                [node_id] => 1
                [node_pid] => 0
            )    [2] => Array
            (
                [node_id] => 8
                [node_pid] => 4
            )    [3] => Array
            (
                [node_id] => 3
                [node_pid] => 1
            )    [6] => Array
            (
                [node_id] => 9
                [node_pid] => 4
            )    [7] => Array
            (
                [node_id] => 5
                [node_pid] => 4
            )    [8] => Array
            (
                [node_id] => 2
                [node_pid] => 1
            ))