【问题标题】:How to set a value in CHtml::textArea in yii如何在 yii 的 CHtml::textArea 中设置一个值
【发布时间】: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)); ?>

但是,这不起作用。我该怎么做?

【问题讨论】:

    标签: yii textarea yii-chtml


    【解决方案1】:

    可以直接设置为第二个参数:

    CHtml::textArea('answer' . $no, $exam->answer, array(
        'rows' => 6, 'cols' => 50, 'class' => "form-control")
    );
    

    更多详情请见CHtml::textArea

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-02-08
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多