方法一:
<?= $form->field($model, '')->textInput(['required' => true]) ?>
方法二:
在model rule中设置某字段为required