当前位置:网站首页>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);
边栏推荐
猜你喜欢
随机推荐
苹果官网商店新上架Mophie系列Powerstation Pro、GaN充电头等产品
NC20164 :最大数MAXNUMBER [线段树]
pnpm 是凭什么对 npm 和 yarn 降维打击的
生命的颜色占卜
Support touch screen slider carousel plugin
sql server收缩日志的作业和记录,失败就是因为和备份冲突了吗?
The toss of MM before going to the street (interesting)
RedisTemplate: 报错template not initialized; call afterPropertiesSet() before using it
Beautifully painted MM set
tear apart loneliness
原型&原型链
egg框架
Controlling number and letter input in ASP
512-color chromatogram
创业者如何吸引风险投资商
egg framework
剑指Offer面试题解总结1-10
[NOIP2010 提高组] 机器翻译
【无标题】目录
嵌入式系统:基本定时器









