当前位置:网站首页>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);
边栏推荐
- SVG big fish eat small fish animation js special effects
- 网页直接访问链接不让安全中心拦截
- 接口全周期的生产力利器Apifox
- k-nearest neighbor fault monitoring based on multi-block information extraction and Mahalanobis distance
- Thinking after writing a code with a very high CPU usage
- 嵌入式实操----基于RT1170 移植memtester做SDRAM测试(二十五)
- 【结构体内功修炼】结构体实现位段(二)
- 工程制图试题
- 动态库之间回调函数使用
- 手机上流行的各类谜语
猜你喜欢
随机推荐
动态库之间回调函数使用
撕裂寂寞
[Structural Internal Power Cultivation] The Mystery of Enumeration and Union (3)
基因数据平台
Beautifully painted MM set
原型&原型链
Why is pnpm hitting npm and yarn dimensionality reduction?
Moonbeam团队发布针对整数截断漏洞的紧急安全修复
D2--FPGA SPI interface communication2022-08-03
Chapter 12 贝叶斯网络
行走社会100绝招
CROS and JSONP configuration
Long-term recruitment embedded development-Shenzhen Baoan
Luogu P4588: [TJOI2018]数学计算
SVG big fish eat small fish animation js special effects
The difference between beautiful MM and ordinary MM
P1160 队列安排
MySQL database error The server quit without updating PID file (/var/lib/mysql/localhost.localdomain.pid)
Adb 授权过程分析
漂亮MM和普通MM的区别









