thinkphp延迟写入setInc错误

hello123321

使用thinkphp orm的延迟写入功能

如果第三个参数延迟时间填写了,webman报错,Error: Call to undefined method Webman\ThinkOrm\ThinkCache::inc()
setInc('view_number', 1, 600);

如果第三个参数延迟时间不填写,正常,
setInc('view_number', 1);

这个怎么解决,谢谢

147 2 0
2个回答

walkor 打赏

更新到 2.1.11 或者后续更高版本

composer require webman/think-orm ^2.1.11
  • hello123321 2026-03-25

    好的,感谢

  • hello123321 2026-03-25

    还是不行,有新的错误 TypeError: think\db\BaseQuery::parseUpdateData(): Argument #1 ($data) must be of type array, null given, called in C:\Users\DELL\Desktop\phpEnv\www\yingbiao_webman\webman\vendor\topthink\think-orm\src\db\BaseQuery.php on line 1440 and defined in C:\Users\DELL\Desktop\phpEnv\www\yingbiao_webman\webman\vendor\topthink\think-orm\src\db\BaseQuery.php:1654

walkor 打赏

给一个重现错误的代码例子

  • hello123321 2026-03-25

    $threadinfo = ForumThread::where('id','=',$fid)->find();
    $threadinfo->isAutoWriteTimestamp(false)->setInc('view_number', 1, 600);

  • walkor 2026-03-25

    截图
    tp应该是不支持你这在结果集上调用setInc(),我用thinkphp 8 也是一样的错误。

    下面这种写法是可以的

    ForumThread::where('id','=',$fid)->setInc('view_number', 1, 600);
  • hello123321 2026-03-25

    好的,谢谢

🔝