我正在成功执行3级,1级和2级的多层多选下拉列表,但是对于3级错误(错误数组到字符串),如何解决? 我附上以下代码:
型号:
function getZonaTree2() {
$types = $this->getZonaType();
$tree = array(''=>'-- Region --');
$this->getListTreeParent($listZona, 0, 0);
foreach($listZona as $r) {
if($r->LEVEL==1) {
$tree[$r->ZONA_NAME] = array();
$zona_parent_1 = $r->ZONA_NAME;
}
if($r->LEVEL==2) {
$tree[$zona_parent_1][$r->ZONA_NAME] = array();
$zona_parent_2 = $r->ZONA_NAME;
}
if($r->LEVEL==3) {
$tree[$zona_parent_1][$zona_parent_2][$r->ZONA_ID] = $r->ZONA_NAME." (".$r->ZONA_CAPITAL.") - ".$types[$r->TYPE];
}
}
return $tree;
}
视图:
<?php
echo form_multiselect('zona_id', $this->Zona_model->getZonaTree2(), array(), "size=8 id='zona_id'");
?>