接口频率限制
composer require topthink/think-throttle
注:限制接口访问频率限制,不是用户,也不是ip
命令,安装插件
composer require topthink/think-throttle
在应用route目录下的app.php内
use think\middleware\Throttle;
示例:
Route::group(function (){
Route:resourece(‘goods’,”Goods”);
})->middleware(Throttle::class,[‘visit_rate’=>’3/m’,]);
总结,三步走:1、命令安装 2、app.php用一下对应的类 3、将示例中间件,放到路由后面,大功告成!