PHP code example of frankerzeng / easy_ratelimiter
1. Go to this page and download the library: Download frankerzeng/easy_ratelimiter library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
frankerzeng / easy_ratelimiter example snippets
// 验证10秒内1次访问
$validate = (new Ratelimiter(['type' => "17665544332", 'times' => 1, 'time' => 10]))->check();
var_dump($validate);// bool(true)
$validate = (new Ratelimiter(['type' => "17665544332", 'times' => 1, 'time' => 10]))->check();
var_dump($validate);// bool(false)