系统在找不到请求方法的时候,定位到一个魔术方法上,然后用这个方法进行处理
当系统找不到这个控制器的时候,定位到这个EmptyController控制器上,进行处理
例子:
PHP页面
public function tiaozhuan(){ $this->utf(); $arr = array( array(1,"公司简介",0), array(2,"新闻中心",0), array(3,"产品中心",0), array(11,"荣誉资质",1), array(12,"分类管理",1), array(13,"子类管理",1), array(21,"公司新闻",2), array(22,"分类管理",2), array(23,"子类管理",2), array(31,"产品展示",3), array(32,"最新产品",3), array(33,"分类管理",3), array(34,"子类管理",3), ); $arr1 = array(); foreach ($arr as $k=>$v){ foreach ($arr1 as $kk => $vv){ if($v[2]== $vv[0]){ $arr1[$kk][] = $v[1]; break; } } if($v[2] == 0){ $arr1[$v[1]] = array($v[0]); } } foreach ($arr1 as $kk => $vv){ array_shift($arr1[$kk]); } //注册一个变量,HTML页面里用 $this->assign('list',$arr1); $this->display(); } 循环
HTML页面
<body> <volist name="list" id="v"> <table cellspacing="0" cellpadding="0" width="150" border="0"> <tr height="22"> <td style="padding-left: 30px" background="__IMGPATH__/menu_bt.jpg"> <a class="menuparent" onclick="expand({$i})" href="javascript:void(0);">{$key}</a> </td> </tr> </table> <table id="child{$i}" style="display: none" cellspacing="0" cellpadding="0" width="150" border="0"> <foreach name="v" item="a"> <tr height="20"> <td align="middle" width="30"><img height="9" src="__IMGPATH__/menu_icon.gif" width="9" /></td> <td><a class="menuchild" href="#" target="right">{$a}</a></td> </tr> </foreach> </table> </volist> </body> 循环
转载于:https://www.cnblogs.com/cp123/p/9227635.html