田心今心ni
2018-01-02 10:51:59浏览 2430
`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;
}`
热门评论
这个下拉框可以实现多选?