Cakephp链接警报
我有以下链接指向cake中的删除函数:Cakephp链接警报,php,cakephp,Php,Cakephp,我有以下链接指向cake中的删除函数: <?php echo $this->Form->postLink(__(''), array('action' => 'delete', $website['Website']['website_id']), array('class' => 'icon-trash '), null, __('Are you sure you want to delete # %s?', $website['Website']['
<?php echo $this->Form->postLink(__(''), array('action' => 'delete', $website['Website']['website_id']), array('class' => 'icon-trash '), null, __('Are you sure you want to delete # %s?', $website['Website']['website_id'])); ?>
现在,正如您所看到的,应该有一条消息说:您确定要删除吗
但当我点击链接时,什么也没发生,当然,我的字段被删除了
那么,如何使链接显示为确认框?这将起作用
<?php echo $this->Form->postLink(__('Delete'), array(
'action' => 'delete', $website['Website']['website_id']), array(
'class' => 'icon-trash'
), __('Are you sure you want to delete # %s?', $website['Website']['website_id'])); ?>
这会奏效的
<?php echo $this->Form->postLink(__('Delete'), array(
'action' => 'delete', $website['Website']['website_id']), array(
'class' => 'icon-trash'
), __('Are you sure you want to delete # %s?', $website['Website']['website_id'])); ?>
您需要在下面的结构中添加代码
echo $this->Html->link(
'Delete',
array('action' => 'delete', $website['Website']['website_id']),
array(),
"Are you sure you wish to delete this recipe?"
);
您需要在下面的结构中添加代码
echo $this->Html->link(
'Delete',
array('action' => 'delete', $website['Website']['website_id']),
array(),
"Are you sure you wish to delete this recipe?"
);
因此,您现在要传递五个参数 删除空值,它应该可以工作
echo $this->Form->postLink(
// title
__('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(
// title
__('delete'),
// URL
array('controller' => 'documents', 'action' => 'delete', $document['id']),
// Options
array('escape' => false),
// confirmMessage
__('Are you sure you want to delete # %s?', $document['file'])
);
见文件
希望这一定会对你有所帮助