當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Posts::delete方法代碼示例

本文整理匯總了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);
開發者ID:AnwarMohamed,項目名稱:Abouda,代碼行數:31,代碼來源:index.php

示例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']);
開發者ID:vdanelia,項目名稱:GeniXCMS,代碼行數:31,代碼來源:pages.control.php

示例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');
 }
開發者ID:TraianAlex,項目名稱:ci1,代碼行數:14,代碼來源:hello.php

示例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>
開發者ID:TensaZangetsu,項目名稱:blog,代碼行數:30,代碼來源:posts.php

示例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'>&times;</a>";
        echo "<span class='glyphicon glyphicon-exclamation-sign' aria-hidden='true'></span>";
        echo "&nbsp;" . $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 
開發者ID:andersoonluan,項目名稱:PHP,代碼行數:31,代碼來源:posts.php


注:本文中的Posts::delete方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。