from yii 文档 http://www.yiiframework.com/doc/api/1.1/CActiveForm#textField-detail:
public string textField(CModel $model, string $attribute, array $htmlOptions=array ( ))
所以你应该有:
$form->textfield($model,'link',array('style'=>'width:600px;'));
我看到你也有一堂课:
$form->textfield($model,'link',array('style'=>'width:600px;', 'class' => 'class_x'));
现在,让我解释一下您的代码中发生了什么:
echo $form->textField($model, 'link', array(
'prepend' => '<i class="icon-4x icon-globe" style="line-height: 54px;"></i>',
'class' => 'span12', 'maxlength' => 999,
'height'=>100,
'htmlOptions' => array('style' => 'height:60px;font-size: 22px;')
));
第一个和第二个参数就可以了
当谈到第三个时,一开始它看起来很好,因为它是一个数组,代表文档中的 html_Options 数组
如果你深入挖掘,你会发现在 html Options 数组中你有另一个 html Options 数组;为什么?
像这样写:
echo $form->textField($model, 'link', array(
'prepend' => '<i class="icon-4x icon-globe" style="line-height: 54px;"></i>',
'class' => 'span12',
'style' => 'height:60px;font-size: 22px;width:999px;',
));