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


PHP Answer::delete方法代码示例

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


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

示例1: edit

 public function edit($step)
 {
     $obj = new Answer();
     if (!$_POST) {
         $data = $this->_get_test();
         $topics = $data['topics'];
         $topic_id = $topics[$step - 1]['id'];
         $condition = array('user_id' => $this->_user->id, 'topic_id' => $topic_id);
         $obj->where($condition)->get();
         $json = array_merge($obj->to_array(), $this->_get_test());
         $json['aChoose'] = $json['aChoose'] ? explode(',', $json['aChoose']) : array();
         echo json_encode($this->_filter($json));
     } else {
         if (isset($_POST['model']) and $model = $_POST['model']) {
             $data = json_decode($model);
             $get = $this->_save($data);
             if (isset($get['error'])) {
                 json_encode($get);
             } else {
                 $get['aChoose'] = explode(',', $get['aChoose']);
                 echo json_encode($this->_filter($get));
             }
         } else {
             if (isset($_POST['_method']) and $_POST['_method'] === 'DELETE') {
                 $obj->delete();
             }
         }
     }
 }
开发者ID:htom78,项目名称:peersay,代码行数:29,代码来源:answers.php

示例2: delete

 public static function delete($id)
 {
     $db = Connection::getInstance();
     // delete answer
     require_once ROOT . DS . 'application' . DS . 'model' . DS . 'class.answer.php';
     Answer::delete($id);
     // delete thread
     $sql = "DELETE FROM sse_thread WHERE thread_id = :id";
     $statement = $db->prepare($sql);
     $statement->execute(array(':id' => $id));
 }
开发者ID:rahmanadianto,项目名称:IF3110-2015-T1,代码行数:11,代码来源:class.thread.php

示例3: connectToEncryptedMySQL

<?php

require_once "/etc/apache2/capstone-mysql/encrypted-config.php";
require_once "answer.php";
$pdo = connectToEncryptedMySQL("/etc/apache2/data-design/jfindley2.ini");
$answer = new Answer(null, 1, 2, "The answer", null);
$answer->insert($pdo);
$answer->setAnswerText("A better answer");
$answer->update($pdo);
$answer->delete($pdo);
开发者ID:jfindley2,项目名称:amazon-product,代码行数:10,代码来源:answer-shakedown.php

示例4: Answer

 function test_delete()
 {
     //Arrange
     $test_field = "Joe FindById";
     $test_quest_id = 1;
     $test_answer = new Answer($test_field, $test_quest_id);
     $test_answer->save();
     $test_field2 = "Red FindById";
     $test_quest_id2 = 2;
     $test_answer2 = new Answer($test_field2, $test_quest_id2);
     $test_answer2->save();
     //Act
     $test_answer->delete();
     $result = Answer::getAll();
     //Assert
     $this->assertEquals($test_answer2, $result[0]);
 }
开发者ID:umamiMike,项目名称:promptr,代码行数:17,代码来源:AnswerTest.php


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