Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
yuenblue
PhpDemo
提交
e6c054bd
P
PhpDemo
项目概览
yuenblue
/
PhpDemo
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
PhpDemo
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
e6c054bd
编写于
3月 28, 2024
作者:
Y
yuenblue
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
aa
上级
9cafa2fa
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
89 addition
and
4 deletion
+89
-4
README.md
README.md
+82
-0
demotp6/tests/DemoTp6.php
demotp6/tests/DemoTp6.php
+7
-4
未找到文件。
README.md
浏览文件 @
e6c054bd
...
...
@@ -26,3 +26,85 @@ php -dxdebug.mode=debug -dxdebug.start_with_request=yes -dxdebug.client_host=lo
1.
将"vendor/thinkcmf/cmf-install"文件夹删除;
2.
最好执行"composer remove thinkcmf/cmf-install"删除!
另请对data/config/database.php文件做好备份,以防丢失!
## Class Model
*
@method static $this scope(string|array $scope) static 查询范围
*
@method static $this where(mixed $field, string $op = null, mixed $condition = null) static 查询条件
*
@method static $this whereRaw(string $where, array $bind = [], string $logic = 'AND') static 表达式查询
*
@method static $this whereExp(string $field, string $condition, array $bind = [], string $logic = 'AND') static 字段表达式查询
*
@method static $this when(mixed $condition, mixed $query, mixed $otherwise = null) static 条件查询
*
@method static $this join(mixed $join, mixed $condition = null, string $type = 'INNER', array $bind = []) static JOIN查询
*
@method static $this view(mixed $join, mixed $field = null, mixed $on = null, string $type = 'INNER') static 视图查询
*
@method static $this with(mixed $with, callable $callback = null) static 关联预载入
*
@method static $this count(string $field = '
*
') static Count统计查询
*
@method static $this min(string $field, bool $force = true) static Min统计查询
*
@method static $this max(string $field, bool $force = true) static Max统计查询
*
@method static $this sum(string $field) static SUM统计查询
*
@method static $this avg(string $field) static Avg统计查询
*
@method static $this field(mixed $field, boolean $except = false, string $tableName = '', string $prefix = '', string $alias = '') static 指定查询字段
*
@method static $this fieldRaw(string $field) static 指定查询字段
*
@method static $this union(mixed $union, boolean $all = false) static UNION查询
*
@method static $this limit(mixed $offset, integer $length = null) static 查询LIMIT
*
@method static $this order(mixed $field, string $order = null) static 查询ORDER
*
@method static $this orderRaw(string $field, array $bind = []) static 查询ORDER
*
@method static $this cache(mixed $key = null, integer|
\D
ateTime $expire = null, string $tag = null) static 设置查询缓存
*
@method static mixed value(string $field, mixed $default = null) static 获取某个字段的值
*
@method static array column(string $field, string $key = '') static 获取某个列的值
*
@method static $this find(mixed $data = null) static 查询单个记录
*
@method static $this findOrFail(mixed $data = null) 查询单个记录
*
@method static Collection|$this[] select(mixed $data = null) static 查询多个记录
*
@method static $this get(mixed $data = null, mixed $with = [], bool $cache = false, bool $failException = false) static 查询单个记录 支持关联预载入
*
@method static $this getOrFail(mixed $data = null, mixed $with = [], bool $cache = false) static 查询单个记录 不存在则抛出异常
*
@method static $this findOrEmpty(mixed $data = null) static 查询单个记录 不存在则返回空模型
*
@method static Collection|$this[] all(mixed $data = null, mixed $with = [], bool $cache = false) static 查询多个记录 支持关联预载入
*
@method static $this withAttr(array $name,
\C
losure $closure = null) static 动态定义获取器
*
@method static $this withJoin(string|array $with, string $joinType = '') static
*
@method static $this withCount(string|array $relation, bool $subQuery = true) static 关联统计
*
@method static $this withSum(string|array $relation, string $field, bool $subQuery = true) static 关联SUM统计
*
@method static $this withMax(string|array $relation, string $field, bool $subQuery = true) static 关联MAX统计
*
@method static $this withMin(string|array $relation, string $field, bool $subQuery = true) static 关联Min统计
*
@method static $this withAvg(string|array $relation, string $field, bool $subQuery = true) static 关联Avg统计
*
@method Paginator|$this paginate(int|array $listRows = null, int|bool $simple = false, array $config = []) static 分页
## DbManager
*
@method static
\t
hink
\d
b
\Q
uery master() static 从主服务器读取数据
*
@method static
\t
hink
\d
b
\Q
uery readMaster(bool $all = false) static 后续从主服务器读取数据
*
@method static
\t
hink
\d
b
\Q
uery table(string $table) static 指定数据表(含前缀)
*
@method static
\t
hink
\d
b
\Q
uery name(string $name) static 指定数据表(不含前缀)
*
@method static
\t
hink
\d
b
\E
xpression raw(string $value) static 使用表达式设置数据
*
@method static
\t
hink
\d
b
\Q
uery where(mixed $field, string $op = null, mixed $condition = null) static 查询条件
*
@method static
\t
hink
\d
b
\Q
uery whereRaw(string $where, array $bind = []) static 表达式查询
*
@method static
\t
hink
\d
b
\Q
uery whereExp(string $field, string $condition, array $bind = []) static 字段表达式查询
*
@method static
\t
hink
\d
b
\Q
uery when(mixed $condition, mixed $query, mixed $otherwise = null) static 条件查询
*
@method static
\t
hink
\d
b
\Q
uery join(mixed $join, mixed $condition = null, string $type = 'INNER') static JOIN查询
*
@method static
\t
hink
\d
b
\Q
uery view(mixed $join, mixed $field = null, mixed $on = null, string $type = 'INNER') static 视图查询
*
@method static
\t
hink
\d
b
\Q
uery field(mixed $field, boolean $except = false) static 指定查询字段
*
@method static
\t
hink
\d
b
\Q
uery fieldRaw(string $field, array $bind = []) static 指定查询字段
*
@method static
\t
hink
\d
b
\Q
uery union(mixed $union, boolean $all = false) static UNION查询
*
@method static
\t
hink
\d
b
\Q
uery limit(mixed $offset, integer $length = null) static 查询LIMIT
*
@method static
\t
hink
\d
b
\Q
uery order(mixed $field, string $order = null) static 查询ORDER
*
@method static
\t
hink
\d
b
\Q
uery orderRaw(string $field, array $bind = []) static 查询ORDER
*
@method static
\t
hink
\d
b
\Q
uery cache(mixed $key = null , integer $expire = null) static 设置查询缓存
*
@method static
\t
hink
\d
b
\Q
uery withAttr(string $name,callable $callback = null) static 使用获取器获取数据
*
@method static mixed value(string $field) static 获取某个字段的值
*
@method static array column(string $field, string $key = '') static 获取某个列的值
*
@method static mixed find(mixed $data = null) static 查询单个记录
*
@method static mixed select(mixed $data = null) static 查询多个记录
*
@method static integer insert(array $data, boolean $replace = false, boolean $getLastInsID = false, string $sequence = null) static 插入一条记录
*
@method static integer insertGetId(array $data, boolean $replace = false, string $sequence = null) static 插入一条记录并返回自增ID
*
@method static integer insertAll(array $dataSet) static 插入多条记录
*
@method static integer update(array $data) static 更新记录
*
@method static integer delete(mixed $data = null) static 删除记录
*
@method static boolean chunk(integer $count, callable $callback, string $column = null) static 分块获取数据
*
@method static
\G
enerator cursor(mixed $data = null) static 使用游标查找记录
*
@method static mixed query(string $sql, array $bind = [], boolean $master = false, bool $pdo = false) static SQL查询
*
@method static integer execute(string $sql, array $bind = [], boolean $fetch = false, boolean $getLastInsID = false, string $sequence = null) static SQL执行
*
@method static
\t
hink
\P
aginator paginate(integer $listRows = 15, mixed $simple = null, array $config = []) static 分页查询
*
@method static mixed transaction(callable $callback) static 执行数据库事务
*
@method static void startTrans() static 启动事务
*
@method static void commit() static 用于非自动提交状态下面的查询提交
*
@method static void rollback() static 事务回滚
*
@method static boolean batchQuery(array $sqlArray) static 批处理执行SQL语句
*
@method static string getLastInsID(string $sequence = null) static 获取最近插入的ID
\ No newline at end of file
demotp6/tests/DemoTp6.php
浏览文件 @
e6c054bd
...
...
@@ -40,7 +40,7 @@ class DemoTp6 extends TestCase{
var_dump
(
$bb
,
$cc
);
}
function
test_select_user
()
{
$user
=
User
::
find
(
3
);
$user
=
User
::
find
(
2
);
print
User
::
class
;
print
UserState
::
from
(
$user
->
status
)
->
label
();
}
...
...
@@ -56,12 +56,15 @@ class DemoTp6 extends TestCase{
// table方法必须指定完整的数据表名
$app
=
App
();
$aa
=
$app
->
db
->
table
(
'tp6_user'
)
->
find
(
2
);
var_dump
(
$aa
);
// $app=App();
// $aa=$app->db->table('tp6_user')->find(2);
// var_dump($aa);
// $aa=Db::table('tp6_user')->find(2);
// var_dump($aa);
$aa
=
Db
::
table
(
'tp6_user'
)
->
find
(
2
);
var_dump
(
$aa
);
// $app = app();
// $user = new User();
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录