方法一:
<?php
$psObjs = Poststatus::find()->all();
$allStatus = ArrayHelper::map($psObjs,'id','name');
?>
<?=$form->field($model,'status')
->dropDownList($allStatus,
['prompt'=>'请选择状态']);
?>
方法二:
<?php
$psArray = Yii::$app->db->createCommand('select id,name from poststatus')->queryAll();
$allStatus = ArrayHelper::map($psArray,'id','name');
?>
<?=$form->field($model,'status')
->dropDownList($allStatus,
['prompt'=>'请选择状态']);
?>