use frontend\models\UploadForm;$model = new UploadForm();return $this->render('index', ['model' => $model]);
views
<?phpuse yii\widgets\ActiveForm;?>
<?php $form = ActiveForm::begin(['action'=>'index.php?r=upload/index','options' => ['enctype' => 'multipart/form-data']]) ?>
<?php echo $form->field($model,'city')->dropDownList(['0'=>'葫芦岛','1'=>'兴城'],['style'=>'width:200px'])?>
<?php echo $form->field($model,'sex')->radioList(['女'=>'女','男'=>'男'])->hint('请选择你的性别');?>
<?php echo $form->field($model,'name')->passwordInput(['style'=>'width:200px']);?></
Yii2框架表单
最新推荐文章于 2021-03-18 00:23:49 发布
![](https://img-home.csdnimg.cn/images/20240711042549.png)