标签:
<?php // 本类由系统自动生成,仅供测试用途 class TestAction extends Action { public function index(){ $select=M(‘select‘); $rs=$select->where(‘parent_id=0‘)->select(); //$rs=$select->where(‘parent_id=‘.$parentid)->select(); for($i=0;$i<count($rs);$i++){ if($i==0){ echo ‘<p class="letter" id="‘.$rs[$i][‘index‘].‘">‘.$rs[$i][‘index‘].‘</p>‘; $index=$rs[$i][‘index‘]; } //去重输出首字母 if($rs[$i][‘index‘]!=$index){ echo ‘<p class="letter" id="‘.$rs[$i][‘index‘].‘">‘.$rs[$i][‘index‘].‘</p>‘; $index=$rs[$i][‘index‘]; } echo $rs[$i][‘name‘].‘<br>‘; $series=$select->where(‘parent_id=‘.$rs[$i][‘id‘])->select(); for($j=0;$j<count($series);$j++){ echo $series[$j][‘name‘].‘<br>‘; $model=$select->where(‘parent_id=‘.$series[$i][‘id‘])->select(); for($x=0;$x<count($model);$x++){ echo $model[$x][‘name‘].‘<br>‘; } //for() } } } }
标签:
原文地址:http://my.oschina.net/rain21/blog/415474