在我的 Web 应用程序中,我想将默认值设置为 CHtml::textArea。在我看来,
<?php echo CHtml::textArea('answer' . $no, '', array('rows' => 6, 'cols' => 50, 'class' => "form-control",'value'=>$exam->answer)); ?>
但是,这是行不通的。我怎样才能做到这一点?
可以直接设置为第二个参数:
CHtml::textArea('answer' . $no, $exam->answer, array(
'rows' => 6, 'cols' => 50, 'class' => "form-control")
);
有关详细信息,请参阅CHtml::textArea。