0

如何在 cakephp 中创建单选按钮并将图像附加到每个按钮?是否有可能,我正在使用创建一个动态单选按钮列表

echo $this->Form->input('db.field', array('type' => 'radio', 'options' => $myOptions,  'label' => 'myLabel')); ?>

请问有什么帮助吗?感谢:D

4

1 回答 1

2

您可以简单地将图像放入选项数组中:

$myOptions          = array();
$myOptions['power'] = $this->Html->image('cake.power.gif');
$myOptions['icon']  = $this->Html->image('cake.icon.png');

echo $this->Form->input('db.field', array('type' => 'radio', 'options' => $myOptions,  'label' => 'myLabel')); ?>
于 2012-04-18T07:43:14.770 回答