这里利用数组来做实例,有需要的要改成数据库查询然后再存到数据操作,实例代码如下:
- <?php
-
- $a = array(
- 'AAAAAA' => array(
- 'aaaaaa' => array(
- '111111',
- '222222',
- '333333'
- ),
- 'bbbbbb' => array(
- '111111',
- '222222',
- '333333'
- ),
- 'cccccc' => array(
- '111111',
- '222222',
- '333333'
- ),
- ),
- 'BBBBBB' => array(
- 'aaaaaa' => array(
- '111111',
- '222222',
- '333333'
- ),
- 'bbbbbb'=> array(
- '111111',
- '222222',
- '333333'
- ),
- 'cccccc'=> array(
- '111111',
- '222222',
- '333333'
- ),
- ),
- 'CCCCCC' => array(
- 'aaaaaa'=> array(
- '111111',
- '222222',
- '333333'
- ),
- 'bbbbbb'=> array(
- '111111',
- '222222',
- '333333'
- ),
- 'cccccc' => array(
- '111111',
- '222222',
- '333333'
- ),
- ),
- );
-
- foreach ($a as $k=>$v){
- echo $k."<br>";
-
- foreach($v as $key=>$val){
- echo " ".$key."<br>";
-
- if(is_array($val)){
- foreach($val as $kkk=>$vall){
- echo " ".$vall."<br>";
- }
- }
- }
- echo "<br>";
- }
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- ?>
|