【发布时间】:2016-10-22 23:51:06
【问题描述】:
在我的 Web 应用程序中,我想为 CHtml::textArea 设置一个默认值。 在我看来,
<?php echo CHtml::textArea('answer' . $no, '', array('rows' => 6, 'cols' => 50, 'class' => "form-control",'value'=>$exam->answer)); ?>
但是,这不起作用。我该怎么做?
【问题讨论】:
在我的 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。
【讨论】: