如何将空字段添加到 activeDropDownList yii2?

how to add empty field to activeDropDownList yii2?

我有一个使用 ArrayHelper::map 的下拉列表 如下代码:

<?= Html::activeDropDownList($model2, 'expert_id',
      ArrayHelper::map(Experts::find()->all(), 'username', 'username')) ?>

可以正常工作,但我想添加空字段或其他喜欢的字段... 我该怎么做?

尝试使用数组合并

 <?= Html::activeDropDownList($model2, 'expert_id',
  array_merge(array('val1'=>'val1'), ArrayHelper::map(Experts::find()->all(), 'username', 'username'))) ?>

清理器:(如果您只想添加空字段)

<?= Html::activeDropDownList($model2, 'expert_id',
   ArrayHelper::map(Experts::find()->all(), 'username', 'username')), array('placeholder'=>'') ?>