ThinkChat🤖让你学习和工作更高效,注册即送10W Token,即刻开启你的AI之旅 广告
~~~ /*限流*/ $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)); } /*限流*/ ~~~