🔥码云GVP开源项目 12k star Uniapp+ElementUI 功能强大 支持多语言、二开方便! 广告
~~~ /*限流*/ $executed = RateLimiter::attempt('obtaining:'.$user_id, 1, function (){}); if (!$executed) { return $this->error('1 مىنۇتتىن كىيىن قايتا سىناڭ'); } /*限流*/ ~~~ 意思是每分钟内只做 1 次操作 ~~~ /*限流*/ $executed = RateLimiter::attempt('obtaining:'.$user_id, 5, function (){}); if (!$executed) { return $this->error('1 مىنۇتتىن كىيىن قايتا سىناڭ'); } /*限流*/ ~~~ 意思是每分钟内只做 5 次操作 ~~~ /*限流*/ $limiter_name = 'email:'.$email; $executed = RateLimiter::attempt($limiter_name, 1, function (){}); if (!$executed) { $seconds = RateLimiter::availableIn($limiter_name); return $this->error(sprintf('%d سىكۇنتتىن كىيىن قايتا يوللاڭ', $seconds)); } /*限流*/ ~~~