In Yii, forms (form widgets) are mainly created through the yii\widgets\ActiveForm class. Let's introduce how to write forms in yii. We hope it will be helpful to students who are learning the yii framework!
How to write a yii framework form?
(1) First create a form instance
<?php $form=ActiveForm::begin();?> //$form是表单实例 ... <?php ActiveForm::end();?>
ActiveForm::begin() not only marks the start of the form, but also creates a form instance.
Recommended learning: yii tutorial
(2) Then create an ActiveField instance
<?php $form=ActiveForm::begin();?> + <?= $form->field($model,'title')?> <?php ActiveForm::end();?>
and place it in ActiveForm: Everything between :begin() and ActiveForm::end() is wrapped in the HTML