当前位置: 首页>>代码示例>>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;未经允许,请勿转载。