当前位置:网站首页>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);
边栏推荐
- 【 a daily topic 】 1403. The increasing order of the sequence, boy
- MySQL database error The server quit without updating PID file (/var/lib/mysql/localhost.localdomain.pid)
- 程序设计中的感悟
- 真正爱你的女人是这样的
- DPU — 功能特性 — 安全系统的硬件卸载
- Detailed explanation of DNS query principle
- [Structural Internal Power Cultivation] The Mystery of Enumeration and Union (3)
- DPU — 功能特性 — 网络系统的硬件卸载
- Fiddler tool explanation
- XSS靶机通关以及XSS介绍
猜你喜欢
随机推荐
How to make pictures clear in ps, self-study ps software photoshop2022, simple and fast use ps to make photos clearer and more textured
Nn. Unfold and nn. The fold
Walk 100 trick society
Data source object management Druid and c3p0
Adb authorization process analysis
8.4 Summary of the mock competition
k-nearest neighbor fault monitoring based on multi-block information extraction and Mahalanobis distance
php向mysql写入数据失败
DPU — 功能特性 — 存储系统的硬件卸载
Pagoda measurement - building small and medium-sized homestay hotel management source code
DPU — 功能特性 — 安全系统的硬件卸载
六年团队Leader实战秘诀|程序员最重要的八种软技能 - 脸皮薄容易耽误事 - 自我营销
Three solutions to solve cross-domain in egg framework
MySQL database error The server quit without updating PID file (/var/lib/mysql/localhost.localdomain.pid)
DPU — 功能特性 — 管理系统的硬件卸载
嵌入式系统:基本定时器
微信小程序请求封装
Support touch screen slider carousel plugin
TensorFlow安装步骤
D2--FPGA SPI interface communication2022-08-03








