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


PHP Note::delete方法代码示例

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


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

示例1: json_encode

            $res = self::query("UPDATE `notes` SET `title` = '{$title}', `message` = '{$message}' WHERE `notes`.`id` = {$id}");
        }
        // Return query result
        return json_encode($res);
    }
    public static function delete($id)
    {
        $res = self::query("DELETE FROM notes WHERE `id` = {$id}");
        return $res;
    }
}
// Our script requires JSON data format
// Set Content-Type to JSON
header('Content-Type: application/json');
// if GET request then return the list of all items
// if POST request then add, edit or delete
switch ($_SERVER['REQUEST_METHOD']) {
    case 'GET':
        echo Note::getAll();
        break;
    case 'POST':
        if (isset($_POST['action'])) {
            echo Note::delete($_POST['id']);
        } else {
            print_r(Note::save($_POST));
        }
        break;
    default:
        echo 'Unknown operation';
        break;
}
开发者ID:BriniDesigner,项目名称:Todo-list,代码行数:31,代码来源:todo.php

示例2: destroy_note

 public function destroy_note()
 {
     if (!isset($_POST['note_id'])) {
         error(__("Error"), __("No note ID specified.", "extend"));
     }
     $note = new Note($_POST['note_id']);
     if ($note->no_results) {
         error(__("Error"), __("Invalid note ID specified.", "extend"));
     }
     if (!$note->deletable()) {
         show_403(__("Access Denied"), __("You do not have sufficient privileges to delete this note.", "extend"));
     }
     Note::delete($note->id);
     Flash::notice(__("Note deleted.", "extend"), $note->version->url());
 }
开发者ID:vito,项目名称:chyrp-site,代码行数:15,代码来源:controller.Extend.php

示例3: rename

 public function rename()
 {
     $from = $this->params->from;
     $to = $this->params->to;
     if ($this->username && !$this->is_owner) {
         return $this->redirect($from);
     }
     $orig = new Note(array('url' => "/{$from}"));
     if ($orig->load()) {
         // Check that the destination is missing or empty of words
         $dest = new Note(array('url' => "/{$to}"));
         if ($dest->load()) {
             if (strlen($dest->words)) {
                 return $this->redirect($from);
             }
             $dest->delete();
         }
         $orig->url = "/{$to}";
         $orig->status = STATUS_RENAMED;
         if ($orig->save()) {
             return $this->redirect($to);
         }
     }
 }
开发者ID:hutchike,项目名称:notex,代码行数:24,代码来源:Note.php

示例4: delete

 public function delete()
 {
     $hash_Str = $this->input->get('hash');
     $noteid_Num = $this->input->get('noteid');
     $noteid_Arr = $this->input->post('noteid_Arr[]');
     if (empty($noteid_Arr) && empty($noteid_Num)) {
         $this->load->model('Message');
         $this->Message->show(['message' => '未選擇要刪除的文章', 'url' => 'admin/base/note/note/tablelist']);
     }
     //CSRF過濾
     if ($hash_Str == $this->security->get_csrf_hash()) {
         if (!empty($noteid_Num)) {
             $Note = new Note(['noteid_Num' => $noteid_Num]);
             $Note->delete();
         }
         if (!empty($noteid_Arr)) {
             foreach ($noteid_Arr as $key => $value_note) {
                 $Note = new Note(['noteid_Num' => $value_note]);
                 $Note->delete();
             }
         }
         $this->load->model('Message');
         $this->Message->show(['message' => '刪除成功', 'url' => 'admin/base/note/note/tablelist']);
     } else {
         $this->load->model('Message');
         $this->Message->show(['message' => 'hash驗證失敗,請使用標準瀏覽器進行刪除動作', 'url' => 'admin/base/note/note/tablelist']);
     }
 }
开发者ID:fansWoo,项目名称:win_the_world,代码行数:28,代码来源:Note.php

示例5: delete

 /**
  * Function: delete
  * Deletes the given version, including its notes. Calls the "delete_version" trigger and passes the <Version> as an argument.
  *
  * Parameters:
  *     $id - The version to delete.
  */
 static function delete($id)
 {
     $version = new self($id);
     foreach ($version->notes as $note) {
         Note::delete($note->id);
     }
     foreach ($version->attachments as $attachment) {
         Attachment::delete($attachment->id);
     }
     @unlink(uploaded($version->filename, false));
     @unlink(uploaded($version->preview, false));
     parent::destroy(get_class(), $id);
     if (module_enabled("cacher")) {
         Modules::$instances["cacher"]->regenerate();
     }
 }
开发者ID:vito,项目名称:chyrp-site,代码行数:23,代码来源:Version.php


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