我已经烘焙了一个CRUD表单(cakePHP 2.3),索引页面列出了每行的删除按钮的记录。
我添加了安全性,现在当我按下删除按钮时,我收到了黑洞消息。
<?php echo $this->Form->postLink(__('Delete'), array('action' => 'delete', $comment['Comment']['id']), null, __('Are you sure you want to delete # %s?', $comment['Comment']['id'])); ?>
以上是bake生成的默认代码。
我也在AppController :: beforeFilter中使用LoggableBehaviour和以下内容:
if (sizeof($this->uses) && $this->{$this->modelClass}->Behaviors->attached('Logable')) {
$this->{$this->modelClass}->setUserData($this->activeUser);
}
标记是:
<td class="actions">
<a href="/myapp/forms/view/1">View</a>
<a href="/myapp/forms/edit/1">Edit</a>
<form action="/myapp/forms/delete/1" name="post_52fa2ac48ca50395155261" id="post_52fa2ac48ca50395155261" style="display:none;" method="post">
<input type="hidden" name="_method" value="POST"/>
<input type="hidden" name="data[_Token][key]" value="19b320270fb40befed83662913cbd404c4e7b15d" id="Token579420200"/>
<div style="display:none;">
<input type="hidden" name="data[_Token][fields]" value="4e14eecc0fbdf0accdaab5ced4169b7aa4ab933a%3A" id="TokenFields922800459"/>
<input type="hidden" name="data[_Token][unlocked]" value="" id="TokenUnlocked894635034"/>
</div>
</form><a href="#" onclick="if (confirm('Are you sure you want to delete # 1?')) { document.post_52fa2ac48ca50395155261.submit(); } event.returnValue = false; return false;">Delete</a>
</td>
黑洞错误是:
Error: The requested address '/myapp/users/delete/76' was not found on this server.