thinkphp中的setInc、setDec方法

thinkphp中setInc、setDec方法

可用于统计字段(通常是数字类型的字段)的更新,例如积分,等级,登陆次数等

必须配合连贯操作where一起使用

  $User = M("User"); // 实例化User对象
$User->where('id=5')->setInc('score',3); // 用户的积分加3
$User->where('id=5')->setInc('score'); // 用户的积分加1
$User->where('id=5')->setDec('score',5); // 用户的积分减5
$User->where('id=5')->setDec('score'); // 用户的积分减1
上一篇:系统服务监视、系统服务守护 ServiceMonitor


下一篇:C# 线程间不能调用剪切板的问题