Php 在FormHelper::postLink()中禁用转义将中断警报确认

Php 在FormHelper::postLink()中禁用转义将中断警报确认,php,html,cakephp,cakephp-2.0,Php,Html,Cakephp,Cakephp 2.0,当我在postlink助手中尝试将escape设置为false时,JavaScript警报似乎在Chrome中中断,不确定为什么,因为我没有收到任何控制台错误,它只是在没有初始警报的情况下启动操作 echo $this->Form->postLink('<i class="icon-trash"></i> Delete', array('controller' => 'documents', 'action' => 'delete', $d

当我在postlink助手中尝试将escape设置为false时,JavaScript警报似乎在Chrome中中断,不确定为什么,因为我没有收到任何控制台错误,它只是在没有初始警报的情况下启动操作

echo $this->Form->postLink('<i class="icon-trash"></i> Delete',
    array('controller' => 'documents', 'action' => 'delete', $document['id']),
    array('escape' => false),
    null, __('Are you sure you want to delete # %s?', $document['file'])
);
echo$this->Form->postLink('Delete',
数组('controller'=>'documents','action'=>'delete',$document['id']),
数组('escape'=>false),
null,uuu('确实要删除#%s吗?',$document['file']))
);
有什么建议吗?

参数数量错误 通过添加
escape=>false
选项,您忘记删除第三个参数的占位符
null
。因此,您现在要传递五个参数

删除
null
,它应该可以工作

echo $this->Form->postLink(
    // title
    '<i class="icon-trash"></i> Delete',

    // URL
    array('controller' => 'documents', 'action' => 'delete', $document['id']),

    // Options
    array('escape' => false),

    // confirmMessage
    __('Are you sure you want to delete # %s?', $document['file'])
);
echo$this->Form->postLink(
//头衔
“删除”,
//网址
数组('controller'=>'documents','action'=>'delete',$document['id']),
//选择权
数组('escape'=>false),
//确认信息
__(“是否确实要删除#%s?”,$document['file'])
);

见文件

文档实际上只列出了3个参数,这使得事情更加混乱。从2.6开始,“confirmMessage”参数是一个带有键“confirm”的选项,因此您可以编写:
array('escape'=>false,'confirm'=>uuu('您确定要删除#%s?',$document['file'])