php部分:function build_select($array,$select='',$showAll=0){ $tmp = array(); if($showAll == 1){ $tmp[] = ""; }elseif($showAll == 2){ $tmp[] = ""; } foreach ((array)$array as $key => $val) { if($select == $key){ $tmp[] = ""; }else{ $tmp[] = ""; } } return implode("", $tmp);}public function index(){ $cid = intval(I('get.classid')); $map = array(); $arrList = D("School")->where($map)->order("orderval ASC")->getField("id,name"); $select = funs_build_select($arrList,$cid,1); $this->assign('selectClass', $select);}html部分:复制代码