我想在我的select表单助手中添加一个标签,但是我不太确定如何在cake v2 +中执行此操作.
这是我当前的代码不起作用:
echo $this->Form->select('format_id', $formats, array('label'=>'Format:'));
Run Code Online (Sandbox Code Playgroud)
dec*_*nda 11
你可以这样做:
echo $this->Form->label('Format');
echo $this->Form->select('format_id', $formats, array());
Run Code Online (Sandbox Code Playgroud)
要么
echo $this->Form->input('format_id', array('label'=>'Format', 'type'=>'select', 'options'=>$formats));
Run Code Online (Sandbox Code Playgroud)