我想在Yii2下拉列表中显示所选值,
$_GET价值:
$id = $_GET["cid"];
下载代码
$form->field($model,'userid') ->dropDownList( [User::getUser()],//[ArrayHelper::map(User::findAll(['active' => '1']),'id','name')],['prompt'=>'Select a user','id'=>'user_dropdown'],['options' => [ $id => ['selected' => true] ] ] )->label('');
但这种方法不行!
尝试这个.
原文链接:https://www.f2er.com/php/131418.html$model->userid=$id; $form->field($model,'userid') ->dropDownList(...) ->label('');