本文整理汇总了PHP中Blog::destroy方法的典型用法代码示例。如果您正苦于以下问题:PHP Blog::destroy方法的具体用法?PHP Blog::destroy怎么用?PHP Blog::destroy使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Blog
的用法示例。
在下文中一共展示了Blog::destroy方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: delete
public function delete($id)
{
$Blog = new Blog($this->plural_resource);
$sql = $Blog->destroy($id);
mysqli_query($this->db, $sql) or die(mysqli_error($this->db));
header("Location: ../index");
}
示例2: delete
public function delete($id)
{
$Blog = new Blog($this->table_name, $this->action);
$sql = $Blog->destroy($id);
mysqli_query($this->db, $sql) or die(mysqli_error($this->db));
header("Location: ../index");
}
示例3: deleteAction
public function deleteAction()
{
// make sure they own it
$Blog = new Blog($this->_db, new User($this->_db, $_SESSION['user']['id']));
$post = $Blog->find(array('id' => abs($_GET['id'])));
if (empty($post[0]) || $post[0]['users_id'] != $_SESSION['user']['id']) {
$this->_template->hud = array('class' => 'error', 'message' => 'You do not own this post!');
return false;
}
if ($Blog->destroy($_GET['id'])) {
$this->forward('index', array('class' => 'success', 'message' => 'The post was removed!'));
} else {
$this->_template->hud = array('class' => 'error', 'message' => 'There was a problem removing the post!');
}
}