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


PHP Test::delete方法代碼示例

本文整理匯總了PHP中Test::delete方法的典型用法代碼示例。如果您正苦於以下問題:PHP Test::delete方法的具體用法?PHP Test::delete怎麽用?PHP Test::delete使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Test的用法示例。


在下文中一共展示了Test::delete方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: testTable

 function testTable()
 {
     $tb = Test::table();
     $new_data = ['nickname' => 'z3'];
     $tb->insert($new_data);
     $this->assertEquals(1, $tb->count());
     $this->assertEquals([['nickname' => 'z3']], $tb->selectData());
     $update = $tb->update(['nickname' => 'w5']);
     $this->assertEquals(1, $update);
     $this->assertEquals([['nickname' => 'w5']], $tb->selectData());
     $tb_new = clone $tb;
     $tb_new->where('nickname=%s', 'w5');
     //$this->assertEquals('SELEC', $tb->buildSelect());
     $this->assertEquals([['nickname' => 'w5']], $tb_new->selectData());
     $tb_new->clearWhere();
     $tb_new->andWhere(['nickname' => 'w5']);
     //$this->assertEquals('SELEC', $tb->buildSelect());
     $this->assertEquals([['nickname' => 'w5']], $tb_new->selectData());
     $this->assertEquals(1, $tb_new->update(['nickname' => 'z3']));
     $this->assertEquals([['nickname' => 'z3']], $tb->selectData());
     $obj_list = $tb->select();
     $obj = $obj_list[0];
     /* @var $obj Test */
     $this->assertEquals('z3', $obj->nickname);
     $tb->delete();
     $test = new Test();
     $test->nickname = 'hehe';
     $this->assertEquals(TRUE, $test->save());
     $this->assertEquals('hehe', Test::table()->selectData()[0]['nickname']);
     $test->delete();
     $this->assertEquals([], $tb->selectData());
     $this->assertEquals('SELECT * FROM test Test', $tb->buildSelect());
     $this->assertEquals('SELECT * FROM test Test LIMIT 10', $tb->buildSelect(10));
     $this->assertEquals('SELECT * FROM test Test LIMIT 10 OFFSET 10', $tb->buildSelect(10, 10));
 }
開發者ID:kasonyang,項目名稱:hitar,代碼行數:35,代碼來源:TableTest.php

示例2: edit

 public function edit($id = 0)
 {
     $obj = new User();
     $obj->get_by_id((int) $id);
     $testid = $this->session->userdata('testid');
     $test = new Test();
     $test->get_by_id($testid);
     if (!$_POST) {
         echo $obj->to_json();
     } else {
         if (isset($_POST['model']) and $model = $_POST['model']) {
             $obj->from_json($model);
             if ($obj->save()) {
                 $test->save($obj);
                 //保存關係
                 echo $obj->to_json();
             } else {
                 echo json_encode(array('error' => $obj->error->string));
             }
         } else {
             if (isset($_POST['_method']) and $_POST['_method'] === 'DELETE') {
                 $test->delete($obj);
                 $obj->delete();
             }
         }
     }
 }
開發者ID:htom78,項目名稱:peersay,代碼行數:27,代碼來源:users.php

示例3: json_encode

        if (sizeof($response_data) == 0) {
            $response[] = array('success' => 0, 'message' => 'No Data Found');
        } else {
            $response[] = array('success' => 1, 'data' => $response_data);
        }
    }
    if ($tag == 'selectJoinTest') {
        $table = "*";
        $where = "col1=1";
        $response_data = $test->select_join($table, $where);
        if (sizeof($response_data) == 0) {
            $response[] = array('success' => 0, 'message' => 'No Data Found');
        } else {
            $response[] = array('success' => 1, 'data' => $response_data);
        }
    }
    if ($tag == 'deleteTest') {
        $id = "12";
        $response_data = $test->delete($id);
        if (sizeof($response_data) == 0) {
            $response[] = array('success' => 0, 'message' => 'Operation is not successful');
        } else {
            $response[] = array('success' => 1, 'message' => $test->table_name . ' Info Deleted');
        }
    }
} catch (Exception $ex) {
    $response_data[0]['success'] = 1;
    $response = array('posts' => $response_data);
}
$response = array('posts' => $response);
echo json_encode($response);
開發者ID:niloyniloy,項目名稱:json-webservice,代碼行數:31,代碼來源:Test.php

示例4: Test

<?php

include '../lib/common.inc.php';
$test = new Test();
$test->id = $_REQUEST['test_id'];
$test->delete();
開發者ID:andreyvit,項目名稱:retester,代碼行數:6,代碼來源:test-delete.php

示例5: delete_test

 public function delete_test($test_id)
 {
     $output = new stdClass();
     $output->result = FALSE;
     $output->message = $this->lang->line('admin_tests_error_cant_find_test');
     $this->_transaction_isolation();
     $this->db->trans_begin();
     $test = new Test();
     $test->get_by_id(intval($test_id));
     if ($test->exists()) {
         $test->delete();
         if ($this->db->trans_status()) {
             $this->db->trans_commit();
             $output->result = TRUE;
             $output->message = $this->lang->line('admin_tests_delete_test_success');
         } else {
             $this->db->trans_rollback();
             $output->message = $this->lang->line('admin_tests_error_cant_delete_test');
         }
     } else {
         $this->db->trans_rollback();
     }
     $this->output->set_content_type('application/json');
     $this->output->set_output(json_encode($output));
 }
開發者ID:andrejjursa,項目名稱:list-lms,代碼行數:25,代碼來源:tests.php


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