从ActiveForm在Controller中获取数据(无数据库字段)

时间:2019-05-10 13:44:35

标签: php yii

不知道我如何通过post访问控制器中的ActiveForm Widget中的数据。

型号:

 public $startDate;
 public $endDate;

public function rules()
{
    return [
        ...
        [['startDate, endDate'], 'safe'], //<-not sure if this is needed
        ...
    ];
}

查看:

<?php $form = ActiveForm::begin(['options' => ['method' => 'post']]) ?>

    <?= $form->field($model,'startDate'); ?>


    <?= $form->field($model,'endDate'); ?>

    <?php ActiveForm::end(); ?>

现在我不知道如何在Controller中获取startDate和endDate的值。

0 个答案:

没有答案
相关问题