Sign in with twitter.

You can follow the user and hashtags.

Share your tips on social media.

Post relative tips.

If you have relative tips, click [Add relative tips] to post.

Deleteメソッドへのリンクは「$this->Form->postLink()」で処理する [CakePHP2.1]

@takahashiyuya@takahashiyuya 4533 viewer 68 embed viewer embed


<?php echo $this->Form->postLink(__('Delete'), array('action' => 'delete', $blog['Blog']['id']), null, __('Are you sure you want to delete # %s?', $blog['Blog']['id'])); ?>


public function delete($id = null) {
if (!$this->request->is('post')) {
throw new MethodNotAllowedException();
$this->Blog->id = $id;
if (!$this->Blog->exists()) {
throw new NotFoundException(__('Invalid blog'));
if ($this->Blog->delete()) {
$this->Session->setFlash(__('Blog deleted'));
$this->redirect(array('action' => 'index'));
$this->Session->setFlash(__('Blog was not deleted'));
$this->redirect(array('action' => 'index'));


Click this to change format.

Add relative tips

Users who share this tip.