如果我使用单词链接删除如下
<?php
echo $this->Html->link(__('Delete', true), array('action' => 'delete', $company['Company'] ['id']), null, sprintf(__('Are you sure you want to delete # %s?', true), $company['Company']['id']));
?>
因此会有一条删除数据的确认消息。
但如果我使用图标删除信息如下
<?php
echo $html->link( $html->image('delete.png'), $companydeletelink , array('escape' => false, 'title'=>'Delete', sprintf('Are you sure you want to delete # %s?')) );
?>
将出现警告,并且消息未提示。
答案 0 :(得分:1)
请发布您收到的警告。我想你的第二个例子有几个问题:
sprintf应该在选项数组
之外link($ html-&gt; image('delete.png'),$ companydeletelink,array('escape'=&gt; false,'title'=&gt;'删除'),sprintf('你确定你想要删除#%s?',array($ example ['Company'] ['id'])); ?&GT;