PHP完全自学手册(珍藏版) 中文pdf扫描版下载
Yii2.0 默认的 dropdownlist 的使用方法. <?php echo $form->field($model, 'name[]')->dropDownList(['a' => 'Item A', 'b' => 'Item B', 'c' => 'Item C']); 在yii2中加放请选择的下拉菜单 <php echo $form->field($model, 'name[]')->dropDownList($listData, ['prompt'=>'Select...']);> DropDownList 在模型中使用 <?php //use app\models\Country; $countries=Country::find()->all(); //use yii\helpers\ArrayHelper; $listData=ArrayHelper::map($countries,'code','name'); echo $form->field($model, 'name')->dropDownList( $listData, ['prompt'=>'Select...']);
转载请注明:谷谷点程序 » yii2下拉菜单dropDownList的例子