当前位置:网站首页>thinkPHP5 实现点击量(数据自增/自减)
thinkPHP5 实现点击量(数据自增/自减)
2022-08-05 08:34: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 Star Wars Style Toggle Toggle Button
- How to replace colors in ps, self-study ps software photoshop2022, replace one color of a picture in ps with another color
- 控制器-----controller
- Redis实现分布式锁-原理-问题详解
- 让程序员崩溃的N个瞬间(非程序员误入)
- 【结构体内功修炼】枚举和联合的奥秘(三)
- 【 a daily topic 】 1403. The increasing order of the sequence, boy
- unity 头发的渲染
- Iptables implementation under the network limited (NTP) synchronization time custom port
- Why is pnpm hitting npm and yarn dimensionality reduction?
猜你喜欢

国际原子能机构总干事称乌克兰扎波罗热核电站安全形势堪忧

吴恩达深度学习deeplearning.ai——第一门课:神经网络与深度学习——第二节:神经网络基础(下)

spark集群部署(第三弹)

What is a good movie to watch on Qixi Festival?Crawl movie ratings and save to csv file

Adb 授权过程分析

Ethernet Principle

DataFrame insert row and column at specified position

Three solutions to solve cross-domain in egg framework

Support touch screen slider carousel plugin

TensorFlow installation steps
随机推荐
RedisTemplate: error template not initialized; call afterPropertiesSet() before using it
routing----router
【结构体内功修炼】枚举和联合的奥秘(三)
支持触屏slider轮播插件
Luogu P4588: [TJOI2018]数学计算
How to replace colors in ps, self-study ps software photoshop2022, replace one color of a picture in ps with another color
Luogu: P2574 XOR的艺术 [线段树]
8.4 Summary of the mock competition
The magic weapon for small entrepreneurs!
“充钱”也难治快手的“亏亏亏”?
Controlling number and letter input in ASP
DPU — 功能特性 — 网络系统的硬件卸载
Codeforce 8.1-8.7做题记录
love is a sad song
TensorFlow installation steps
[Structural Internal Power Cultivation] Structural Realization Stages (2)
控制器-----controller
SQL SERVER关于主从表触发器设计
原型&原型链
D2--FPGA SPI接口通信2022-08-03