当前位置: 首页>>代码示例>>PHP>>正文


PHP USER::delete方法代码示例

本文整理汇总了PHP中USER::delete方法的典型用法代码示例。如果您正苦于以下问题:PHP USER::delete方法的具体用法?PHP USER::delete怎么用?PHP USER::delete使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在USER的用法示例。


在下文中一共展示了USER::delete方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: operationUser

 /**
  * Выполняет операцию над отмеченными пользователями в админке.
  * @return boolean
  */
 public function operationUser()
 {
     $operation = $_POST['operation'];
     if (empty($_POST['users_id'])) {
         $this->messageError = 'Необходимо отметить пользователей!';
         return false;
     }
     if ($operation == 'delete') {
         foreach ($_POST['users_id'] as $userId) {
             $del = USER::delete($userId);
             if (!$del) {
                 $this->messageSucces = 'Удалены отмеченные пользователи, кроме администратора!';
             }
         }
     }
     $this->messageSucces = 'Выделенные пользователи удалены!';
     return true;
 }
开发者ID:WinGood,项目名称:24karcher,代码行数:22,代码来源:actioner.php

示例2: catch

    //runs a query depending on the id of the post
    $query = $conn->prepare("SELECT userID, title FROM blogpost WHERE blogID = :blogID");
    $query->execute(array(":blogID" => $blogID));
    $row = $query->fetch(PDO::FETCH_ASSOC);
    //if no results, display "Oh,no!"
    if ($row == "") {
        echo "OH NO";
    } else {
        //setting variables
        $userIdent = $row['userID'];
        $title = $row['title'];
    }
    if (isset($_POST['delete'])) {
        //if no errors are found, run update
        if ($userID == $userIdent) {
            $user->delete($blogID);
            $submitted[] = "Deleted! Now wasn't that easy?";
        }
    }
} catch (PDOException $e) {
    echo "Error: " . $e->getMessage();
}
/*
//when the post has been changed and the user clicks update
*/
?>

<?php 
//but we also check if the user is the right user
if ($userID == $userIdent) {
    ?>
开发者ID:IrinaTheNerd,项目名称:bloggie,代码行数:31,代码来源:delete.php


注:本文中的USER::delete方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。