0
我正在使用https://github.com/GrahamCampbell/Laravel-Throttle,我想向用戶返回一個消息,指出他們需要等待多少分鐘才能再次嘗試。我檢查了這個教程:http://bicknoyle.com/blog/2015/10/09/throttling-requests-in-laravel/,它提供了下面的例子:在Laravel使用Graham Campbell的Laravel節流閥調節請求
public function render($request, Exception $e)
{
if ($e instanceof \Symfony\Component\HttpKernel\Exception\TooManyRequestsHttpException) {
return response('Too many requests. Slow your roll!');
}
return parent::render($request, $e);
}
我怎樣才能讓用戶知道他們有多少分鐘要等待?
我試過dd($ e);它會返回
-statusCode: 429
-headers: array:1 [▼
"Retry-After" => 120
]
#message: "Rate limit exceeded."
但每次刷新頁面時Retry-After停留在120時,它不會倒數。有什麼想法,我可以解決這個問題?