This paper gives an example of laravel throttle middleware failure problem solving method. Share to everyone for your reference, specific as follows:
By official explanation, the access frequency limit is simple:
Route::get (' Test ', function () {return
' Helle World ';
}) ->middleware (' throttle ');
Also true, cache storage access times, make judgments.
Zizaco/entrust (a role-based Rights Management Pack) was used before, in which the cache_driver=file in. Env was changed to Cache_driver=array. So the problem arises. Laravel supports a variety of cache drivers, file, Array, Db, Redis, and so on, but throttle seems to work with a File type driver.
My amendment is as follows:
vendor/illuminate/cache/ratelimiter.php file
Public function __construct (Cache $cache)
{
$this->cache = $cache;
}
Public function __construct ()
{
$this->cache = App (' Cache ')->driver (' file ');
}
It's OK to change the above to the bottom. The throttle middleware also works.
More interested in laravel related content readers can view the site topics: "Laravel Framework Introduction and Advanced Course", "PHP Excellent Development Framework Summary", "Smarty Template Primer Tutorial", "PHP date and Time usage summary", "PHP object-oriented Program Design Introductory Course ", PHP string (String) Usage summary," PHP+MYSQL Database operation Introduction Tutorial "and" PHP common database Operation Skills Summary "
I hope this article will help you with the PHP program design based on Laravel framework.