当前位置:网站首页>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);
边栏推荐
- How to replace colors in ps, self-study ps software photoshop2022, replace one color of a picture in ps with another color
- DataFrame insert row and column at specified position
- 版本号命名规则
- Ethernet Principle
- The color of life divine
- 好资料汇总
- DPU — 功能特性 — 网络系统的硬件卸载
- P1160 队列安排
- DPU — 功能特性 — 存储系统的硬件卸载
- 吴恩达深度学习deeplearning.ai——第一门课:神经网络与深度学习——第二节:神经网络基础(下)
猜你喜欢
“充钱”也难治快手的“亏亏亏”?
吴恩达深度学习deeplearning.ai——第一门课:神经网络与深度学习——第二节:神经网络基础(下)
The Coolest Kubernetes Network Solution Cilium Getting Started Tutorial
Fiddler tool explanation
Spark cluster deployment (third bullet)
数据源对象管理Druid和c3p0
工程制图直线投影练习
苹果官网商店新上架Mophie系列Powerstation Pro、GaN充电头等产品
【结构体内功修炼】结构体内存对齐(一)
接口全周期的生产力利器Apifox
随机推荐
让程序员崩溃的N个瞬间(非程序员误入)
JS语法使用
Three solutions to solve cross-domain in egg framework
六年团队Leader实战秘诀|程序员最重要的八种软技能 - 脸皮薄容易耽误事 - 自我营销
工程制图直线投影练习
Version number naming convention
DataFrame在指定位置插入行和列
Luogu P1966: [NOIP2013 提高组] 火柴排队 [树状数组+逆序对]
链表专项之环形链表
MM上街前的折腾(有趣)
树状数组模版+例题
复现一次循环和两次循环
routing----router
[Untitled] Long-term recruitment of hardware engineers-Shenzhen Baoan
Adb authorization process analysis
egg框架中解决跨域的三种方案
Controlling number and letter input in ASP
Adb 授权过程分析
Controller-----controller
RedisTemplate: error template not initialized; call afterPropertiesSet() before using it