本文整理汇总了PHP中Posts::delete方法的典型用法代码示例。如果您正苦于以下问题:PHP Posts::delete方法的具体用法?PHP Posts::delete怎么用?PHP Posts::delete使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Posts
的用法示例。
在下文中一共展示了Posts::delete方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: function
$app->get('/user/{id:[0-9]+}/posts', function ($request, $response, $args) {
$token = parseToken($request);
$friend_id = $args['id'];
return Posts::all($response, $token, $friend_id);
});
/* Handle get post */
$app->get('/post/{id}', function ($request, $response, $args) {
$token = parseToken($request);
$post_id = $args['id'];
return Posts::get($response, $token, $post_id);
});
/* Handle delete post */
$app->delete('/post/{id}', function ($request, $response, $args) {
$token = parseToken($request);
$post_id = $args['id'];
return Posts::delete($response, $token, $post_id);
});
/* Handle insert post */
$app->post('/post/', function ($request, $response, $args) {
$token = parseToken($request);
$data = parseJsonBody($request);
return Posts::create($response, $token, $data);
});
/* Handle get home posts */
$app->get('/post/', function ($request, $response) {
$token = parseToken($request);
return Posts::home($response, $token);
});
/* Handle get my blocked friends */
$app->get('/user/me/friends/blocked', function ($request, $response) {
$token = parseToken($request);
示例2: foreach
if (isset($_POST['token'])) {
Token::remove($_POST['token']);
}
break;
case 'delete':
# code...
if (!isset($_POST['token']) || !Token::isExist($_POST['token'])) {
// VALIDATE ALL
$alertred[] = TOKEN_NOT_EXIST;
}
if (isset($alertred)) {
$data['alertred'] = $alertred;
} else {
foreach ($post_id as $id) {
# code...
Posts::delete($id);
}
}
if (isset($_POST['token'])) {
Token::remove($_POST['token']);
}
break;
default:
# code...
break;
}
// search query
$where = "";
$qpage = "";
if (isset($_GET['q']) && $_GET['q'] != '') {
$q = Typo::cleanX($_GET['q']);
示例3: delete
public function delete($postID)
{
$post = new Posts();
$post->load($postID);
if (!$post->postID) {
show_404();
}
if ($post->delete()) {
$this->session->set_flashdata('message', 'Data deleted');
} else {
$this->session->set_flashdata('message', 'Problem deleting data');
}
redirect('hello');
}
示例4: confirm
echo " <td>{$row['post_title']}</td>";
echo " <td>{$row['post_author']}</td>";
echo " <td>{$row['post_date']}</td>";
echo " <td>{$row['post_views']}</td>";
echo " <td>{$row['post_img']}</td>";
echo " <td>{$row['post_coment_count']}</td>";
echo " <td>{$row['post_tag']}</td>";
echo " <td><a href='edit_posts.php?edit={$row['posts_id']}'><i class='fa fa-pencil-square-o'></i> Edit</a></td>";
echo " <td><a href='post.php?delete={$row['posts_id']}' onclick='return confirm('Are you sure?') '><i class='fa fa-trash'></i> Delete</a></td>";
echo "<tr></tr>";
}
?>
<?php
if (isset($_GET['delete'])) {
$del_post = $_GET['delete'];
$post = new Posts($db);
$stmt = $post->delete($del_post);
}
?>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
</div>
</body>
</html>
示例5: Posts
<?php
include 'core/init.php';
$posts = new Posts();
$template = new Template();
if (Input::get("action", "GET") == "delete" && Input::Get("id", "GET")) {
try {
$posts->delete(Input::Get("id", "GET"));
Session::Flash("posts", "success", lang('POST_DELETED_SUCCESS'), true);
} catch (Exception $ex) {
Session::Flash("posts", "danger", $ex->GetMessage(), true);
}
Redirect::To("posts.php");
}
$template->header("Posts");
if (Session::exists('posts')) {
foreach (Session::Flash('posts') as $error) {
echo "<div class='alert alert-" . $error['type'] . "' role='alert'>";
echo "<a href='#' class='close' data-dismiss='alert' aria-label='close'>×</a>";
echo "<span class='glyphicon glyphicon-exclamation-sign' aria-hidden='true'></span>";
echo " " . $error['message'];
echo "</div>";
}
}
?>
<div class="messageBox"></div>
<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title"><span class="glyphicon glyphicon-duplicate"></span> <?php