composer require topthink/think-throttle
conf/throttle.php
配置文件,修改可以检测POST的提交方式和返回信息'visit_method' => ['GET', 'POST'], return Response::create('请求太多 ' . $wait_seconds . ' 秒后重试')->code(429);
use think\facade\Route; //接口访问频率 下载命令composer require topthink/think-throttle use think\middleware\Throttle; Route::get('wxlogin', 'login/wxLogin'); //微信登录 Route::group(function (){ //云存储 Route::post('wxupload','Slideshow/upload'); //获取手机号 Route::post('GetPhone', 'login/GetPhone'); //获取微信手机号 phone //创业版 表单提交 Route::post('Addstore', 'Store/Addstore'); //获取微信手机号 phone //check中间件验签 //Throttle接口访问频率 1分钟300次 })->middleware('check')->middleware(Throttle::class,['visit_rate'=>'3/m',]);
组件自动放置路径的README.md文档
vendor/topthink/think-throttle/README.md