2016-12-02 37 views
0

我想$ cluster1中值增加了CHtml加入了CHtml :: activeDropDownList数组值:: activeDropDownList如何在Yii中

$cluster_name_models = new ClusterForm(); 
$records = $cluster_name_models->get_list('grade'); 
$cluster_details=$records['0']['grade']; 
$cluster1=explode(';',$cluster_details); 
$cluster1=Array ([0] => JMC [1] => MMC [2] => SMC); 

回答

0

假设等级相关模型的属性的名称

$cluster_name_models = new ClusterForm(); 
    $records = $cluster_name_models->get_list('grade'); 
    $cluster_details=$records['0']['grade']; 
    $cluster1=explode(';',$cluster_details); 



    echo CHtml::activeDropDownList($model, 
            'grade', 
            $cluster1, 
            array('empty'=>'Select Option')); 
+0

我已经得到像$ cluster1 = Array([0] => JMC [1] => MMC [2] => SMC)的数组;后爆炸如何使它逗号分隔 – Shubhangi

+0

如果爆炸,那么你不需要设置(你已经有一个数组)。 – scaisEdge