yii2 html下拉框

下拉框 带默认值

<?php
    $form=ActiveForm::begin();
    echo $form->field($model,'uname',
        ['inputOptions'=>['class'=>'myway'],
        'template'=>'<span>{label}</span>{input}'])
      ->dropDownList(ArrayHelper::map(array(['uid'=>1,'uname'=>'xm']),'uid','uname') ,['prompt'=>'请选择']); ActiveForm::end(); ?>
原文地址:https://www.cnblogs.com/sheapchen/p/4012718.html