`function getOption($list,$id,$key,$value,$default='顶级'){
$htmls = array();
$htmls[] = "<option value = '0' >".$default."</option>";
foreach ($list as $key=>$value){
$selected = "";
if($v[$key]==$id)$seleected = "selected";
$htmls = "<option value = '."$v[$key]".'".$selected.">".''$v[$value]."</option>";
}
return join("\n",$htmls);
}
function getTypeOptions($obj){
$default = empty($obj->default)?'请选择类型':$obj->default;
$list = M('goods_type')->field('type_id','type_name')->where('enabled=1')->select();
$htmlOptions = getOption($list,$obj->id,'type_id','type_name',$default) ;
return $htmlOptions;
}`
打开App,阅读手记
热门评论
这个下拉框可以实现多选?