代码:
<?php echo $this->Form->submit('<i class="glyphicon glyphicon-arrow-right"></i>', array('class' => array('btn btn-danger')), array('escape' => false)); ?>
而不是glyphicon它只显示文字:
<i class="glyphicon glyphicon-arrow-right"></i>
如何解决这个问题?
答案 0 :(得分:3)
根据docs,您无法使用escape
提交 - 您必须使用Button,并指定它是提交按钮:
echo $this->Form->button('<i class="glyphicon glyphicon-arrow-right"></i>', array(
'type' => 'submit',
'class' => 'btn btn-danger',
'escape' => false
));
答案 1 :(得分:1)
Form->submit()
应该有两个选项,一个标题和一系列选项。你传递标题加上两个数组。此外,我不认为在这种情况下你需要在子数组中包装这些选项。
试试这个:
echo $this->Form->submit('<i class="glyphicon glyphicon-arrow-right"></i>',
array('class' => 'btn btn-danger', 'escape' => false)
);