这家伙有点懒,还没写个性签名!
两种方式 //方法1 直接给模型赋初值 if ($model->getIsNewRecord()) { $model->type = 3; } echo $form->field($model,'type')->dropDownList([1=>'111',2=>'222',3=>'333']); //方法2 同楼上 echo $form->field($model,'type')->dropDownList([1=>'111',2=>'222',3=>'333'],['prompt' => 3,]);
两种方式
//方法1 直接给模型赋初值 if ($model->getIsNewRecord()) { $model->type = 3; } echo $form->field($model,'type')->dropDownList([1=>'111',2=>'222',3=>'333']); //方法2 同楼上 echo $form->field($model,'type')->dropDownList([1=>'111',2=>'222',3=>'333'],['prompt' => 3,]);
1231321