function delete($id = null) {
if (!$id) {
$this->Session->setFlash('Invalid ', true);
}
else if($this->User->del($id)) {
$this->Session->setFlash(' deleted', true);
}
else {
$this->Session->setFlash('Could not delete ', true);
}
$this->redirect(array('action'=>'userlist'));
}
if (!$id) {
$this->Session->setFlash('Invalid ', true);
}
else if($this->User->del($id)) {
$this->Session->setFlash(' deleted', true);
}
else {
$this->Session->setFlash('Could not delete ', true);
}
$this->redirect(array('action'=>'userlist'));
}
<li><?php echo $html->link(__('Delete User', true), array('action' => 'delete', $user['User']['id']), null, sprintf(__('Are you sure you want to delete # %s?', true), $user['User']['id'])); ?> </li>
else if($this->User->del($id)) {
$this->Session->setFlash(' deleted', true);
}
function delete($id = null) {
if (!$id) {
$this->Session->setFlash('Invalid ', true);
}
else{
if($this->User->del($id)) {
$this->Session->setFlash(' deleted', true);
}else {
$this->Session->setFlash('Could not delete ', true);
}
$this->redirect(array('action'=>'userlist'));
}这样试试看