-
Notifications
You must be signed in to change notification settings - Fork 0
/
Deom.php
59 lines (51 loc) · 829 Bytes
/
Deom.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
<?php
/**
* Created by IntelliJ IDEA.
* User: Forevery
* Date: 2018/9/3
* Time: 20:21
*/
use DataBase\DB;
require "DataBase/vendor/autoload.php";
//定义配置文件路径
define("DB_CONFIG_PATH", __DIR__ . '/Config');
/**
*插入
*/
$data = [
'id' => 1,
'name' => 'Forevery'
];
DB::table('user')->insert($data);
/**
* 查询
*/
$result = DB::table('user')
->where('id', '>', 0)
->whereOr('name', '1')
->query();
print_r($result);
/**
* 删除
*/
DB::table('user')
->where('id', '>', 0)
->delete();
/**
* 更新
*/
$update = [
'id' => 1,
'name' => 'Forevery_100'
];
DB::table('user')
->where('id', '>', 0)
->update($update);
/**
* 分页
*/
$result = DB::table('user')
->where('id', '>', 0)
->paginate(5);
print_r($result->data);
echo $result->links();