Php 在模型创建的选择字段中添加空选项字段

Php 在模型创建的选择字段中添加空选项字段,php,cakephp,Php,Cakephp,我的模型用户与国家有关系。所以当我加上 $this->Form->input('country'); 例如,在register.ctp中,将显示国家/地区的selectfield <select name="foo"> <option value="germany">Germany</option> <option value="finland">Finland</option> <option valu

我的模型用户与国家有关系。所以当我加上

$this->Form->input('country');
例如,在register.ctp中,将显示国家/地区的selectfield

<select name="foo">
  <option value="germany">Germany</option>
  <option value="finland">Finland</option>
  <option value="usa">USA</option>
</select>

德国
芬兰
美国
所以我的问题是:是否有一种方法可以让一个空的optionfield成为selectfield中的第一个

比如:


德国
芬兰
美国
试试这个

$this->Form->input('country', array('empty'=>'Select a country'));
注意:这将添加en“empty”键-如果需要整数0键,请使用“empty”=>array(0=>“选择一个国家”)!
$this->Form->input('country', array('empty'=>'Select a country'));
$this->Form->input('country',array('empty'=>'No country'));