PHP开发实例大全(提高卷) 中文完整pdf扫描版[244MB]
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的例子