当前位置:网站首页>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);
边栏推荐
猜你喜欢

七夕看什么电影好?爬取电影评分并存入csv文件

pnpm 是凭什么对 npm 和 yarn 降维打击的

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

Redis implements distributed lock-principle-detailed explanation of the problem

DataFrame在指定位置插入行和列

画法几何及工程制图考试卷A卷

苹果官网商店新上架Mophie系列Powerstation Pro、GaN充电头等产品

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

XSS靶机通关以及XSS介绍

How to replace colors in ps, self-study ps software photoshop2022, replace one color of a picture in ps with another color
随机推荐
How Entrepreneurs Attract Venture Capitalists
iptables实现网络限制下ntp自定义端口同步时间
Insights in programming
Luogu P3368: 【模板】树状数组 2
Luogu P1966: [NOIP2013 提高组] 火柴排队 [树状数组+逆序对]
Nn. Unfold and nn. The fold
随机码的生成
spark集群部署(第三弹)
[Structural Internal Power Cultivation] Structural Realization Stages (2)
学习笔记14--机器学习在局部路径规划中的应用
【无标题】目录
写出了一个CPU占用极高的代码后引发的思考
真正爱你的女人是这样的
How to make a puzzle in PS, self-study PS software photoshop2022, PS make a puzzle effect
【结构体内功修炼】结构体内存对齐(一)
Spark cluster deployment (third bullet)
工程制图试题
哪个是你爱情的颜色?
routing----router
CROS and JSONP configuration