---恢复内容开始---

thinkphp中setInc、setDec方法

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

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

1  $User = M("User"); // 实例化User对象
2  $User->where('id=5')->setInc('score',3); // 用户的积分加3
3  $User->where('id=5')->setInc('score'); // 用户的积分加1
4  $User->where('id=5')->setDec('score',5); // 用户的积分减5
5  $User->where('id=5')->setDec('score'); // 用户的积分减1


上一条消息:

$front = Db::name('area')->where('id', '<', '4')->order('id desc')->limit('0,1')->find();

下一条消息:
$next = Db::name('area')->where('id', '>', '5')->order('id asc')->limit('0,1')->find();

---恢复内容结束---

相关文章:

  • 2021-10-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-02-10
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-03-07
  • 2021-11-26
  • 2022-12-23
  • 2022-02-01
相关资源
相似解决方案