<?php
Use Yii\widgets\linkpager; Using pagination
Use Yii\widgets\activeform;
Use Yii\helpers\url;
Use yii\helpers\html;
?>
Where $model is the controller layer new model obtained
<?php$form = Activeform::begin ([' Action ' = [' Test/getpost '],' Method ' =' Post ',]);?><?echo $form->field ($model,' username ')->textinput ([' MaxLength ' =20])?><?echo $form->field ($model,' Password ')->passwordinput ([' MaxLength ' =20])?><?echo $form->field ($model,' Sex ')->radiolist ([' 1 ' + =' Man ',' 0 ' + =' Women '])?><?echo $form->field ($model,' Edu ')->dropdownlist ([' 1 ' + =' University ',' 2 ' + =' High school ',' 3 ' + =' Junior high School '], [' Prompt ' =' Please select ',' Style ' =' width:120px '])?><?echo $form->field ($model,' File ')->fileinput ()?><?echo $form->field ($model,' Hobby ')->checkboxlist ([' 0 ' + =' Basketball ',' 1 ' + =' Football ',' 2 ' + =' Badminton ',' 3 ' + ="Table tennis"])?><?echo $form->field ($model,' Info ')->textarea ([' Rows ' + =3])?><?echo $form->field ($model,' UserID ')->hiddeninput ([' Value ' =3]) ?><? echo Html::submitbutton ( ' submit ', [ ' class ' = > ' btn btn-primary ', ' name ' => ' Submit-button ']) ?> <? echo Html::resetbutton (" reset ", [ ' class ' =>< Span class= "hljs-string" > ' btn btn-primary ', ' name ' => ' Submit-button ']) ?><?php ActiveForm::end (); ?>
yii2.0 using Actionform to create a form