如何在 cake php 中给 select 标签一个属性?
$options = array('0' => 'News', '1' => 'Movies');
echo $this->Form->select('selectValue', $options, 0, array('id' => 'select') )
这样我就可以为data-url
每个选项赋予一个属性
<select id="select" name="data[Video][gender]" >
<option value="0" data-url = "/news" >News</option>
<option value="1" data-url = "/movies" >Movies</option>
</select>