首页 > 代码库 > 不遗留问题-menu数据拼装-2

不遗留问题-menu数据拼装-2

 1 $res = array(); 2 foreach($idlist_1 as $id1) 3 { 4     $tmp = array(); 5     $tmp1 = array(); 6     $tmp1[] = $id1; 7     foreach($idlist_2 as $id2) 8     { 9         $tmp2 = array();10         if(get_parentid($id2)==$id1)11         {12             $tmp2[] = $id2;13             $tmp3 = array();14             foreach($idlist_3 as $id3)15             {16                 if(get_parentid($id3)==$id2) $tmp3[]=$id3;17             }18             $tmp2[] =  $tmp3;19             $tmp1[] = $tmp2;20         }21     }22     $res[] = $tmp1;23 }
  1 Array  2 (  3     [0] => Array  4         (  5             [0] => 1  6             [1] => Array  7                 (  8                     [0] => 4  9                     [1] => Array 10                         ( 11                             [0] => 13 12                             [1] => 14 13                             [2] => 15 14                         ) 15  16                 ) 17  18             [2] => Array 19                 ( 20                     [0] => 5 21                     [1] => Array 22                         ( 23                             [0] => 16 24                             [1] => 17 25                             [2] => 18 26                         ) 27  28                 ) 29  30             [3] => Array 31                 ( 32                     [0] => 6 33                     [1] => Array 34                         ( 35                             [0] => 19 36                             [1] => 20 37                             [2] => 21 38                         ) 39  40                 ) 41  42         ) 43  44     [1] => Array 45         ( 46             [0] => 2 47             [1] => Array 48                 ( 49                     [0] => 7 50                     [1] => Array 51                         ( 52                             [0] => 22 53                             [1] => 23 54                             [2] => 24 55                         ) 56  57                 ) 58  59             [2] => Array 60                 ( 61                     [0] => 8 62                     [1] => Array 63                         ( 64                             [0] => 25 65                             [1] => 26 66                             [2] => 27 67                         ) 68  69                 ) 70  71             [3] => Array 72                 ( 73                     [0] => 9 74                     [1] => Array 75                         ( 76                             [0] => 28 77                             [1] => 29 78                             [2] => 30 79                         ) 80  81                 ) 82  83         ) 84  85     [2] => Array 86         ( 87             [0] => 3 88             [1] => Array 89                 ( 90                     [0] => 10 91                     [1] => Array 92                         ( 93                             [0] => 31 94                             [1] => 32 95                             [2] => 33 96                         ) 97  98                 ) 99 100             [2] => Array101                 (102                     [0] => 11103                     [1] => Array104                         (105                             [0] => 34106                             [1] => 35107                             [2] => 36108                         )109 110                 )111 112             [3] => Array113                 (114                     [0] => 12115                     [1] => Array116                         (117                             [0] => 37118                             [1] => 38119                             [2] => 39120                         )121 122                 )123 124         )125 126 )

 

不遗留问题-menu数据拼装-2