当前位置:网站首页>thinkPHP5 realizes clicks (data increment/decrement)
thinkPHP5 realizes clicks (data increment/decrement)
2022-08-05 08:39:00 【reg183】
setInc/setDec 如不加第二个参数,默认值为1
// score 字段加 1
Db::table('think_user')->where('id', 1)->setInc('score');
// score 字段加 5
Db::table('think_user')->where('id', 1)->setInc('score', 5);
// score 字段减 1
Db::table('think_user')->where('id', 1)->setDec('score');
// score 字段减 5
Db::table('think_user')->where('id', 1)->setDec('score', 5);
setInc/setDec支持延时更新,如果需要延时更新则传入第三个参数
下例中延时10秒,给score字段增加1
Db::table('think_user')->where('id', 1)->setInc('score', 1, 10);
边栏推荐
猜你喜欢

复现一次循环和两次循环

mySQL数据库初始化失败,有谁可以指导一下吗

让程序员崩溃的N个瞬间(非程序员误入)

Ethernet Principle

EA谈单机游戏:仍是产品组合中极其重要的部分

Why is pnpm hitting npm and yarn dimensionality reduction?

嵌入式实操----基于RT1170 移植memtester做SDRAM测试(二十五)

Pagoda measurement - building small and medium-sized homestay hotel management source code

动态内存开辟(C语言)

嵌入式系统:基本定时器
随机推荐
Walk 100 trick society
基因数据平台
全面讲解GET 和 POST请求的本质区别是什么?原来我一直理解错了
程序设计中的感悟
Nn. Unfold and nn. The fold
Chapter 12 Bayesian Networks
Beautifully painted MM set
16种香饭做法全攻略
nn.unfold和nn.fold
RedisTemplate: 报错template not initialized; call afterPropertiesSet() before using it
手机上流行的各类谜语
动态内存开辟(C语言)
SQL语句查询字段内重复内容,并按重复次数加序号
sphinx匹配指定字段
基于多块信息提取和马氏距离的k近邻故障监测
love is a sad song
IT研发/开发流程规范效能的思考总结
力扣刷题八月第一天
Iptables implementation under the network limited (NTP) synchronization time custom port
路由----router