同样是Listdata 为什么写成下面这样就多出一行

同样是listData 为什么写成下面这样就多出一行[color="#FF0000"]<optgroup label="0">[/color]

<td><?php echo $form->dropDownList($model,‘bumen_bianhao’,

    array(CHtml::listData(Bumen::model()-&gt;findAll(),'bumen_bianhao','bumen' ))); ?&gt;      

生成的html

<td><select name="Hetong[bumen_bianhao]" id="Hetong_bumen_bianhao">

[color="#FF0000"]<optgroup label="0">[/color]

<option value="1">部门1</option>

<option value="2">部门2</option>

<option value="3">部门3</option>

</optgroup>

</select>

</td>

array(

没必要套在CHtml::listData外面 去掉array( 和另外一边括号试试 :)

果然是array嵌套引起的,写成这样问题解决了,多谢!

<td><?php echo $form->dropDownList($model,‘bumen_bianhao’,CHtml::listData(Bumen::model()->findAll(),‘bumen_bianhao’,‘bumen’));?>

</td>