PHP code example of levi / laravel-rotate-captcha
1. Go to this page and download the library: Download levi/laravel-rotate-captcha 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/ */
levi / laravel-rotate-captcha example snippets
// 每天0点抓取一张
$schedule->call(function () {
$image = file_get_contents({custome_api_url});
app('rotate.captcha.file', ['path' => 'origin'])->prepend('costome_name.jpg', $image);
})
->daily();
// 清理前一天
$schedule->call(fn () => app('rotate.captcha.file')->clear())->daily();
// 清理1小时前
$schedule->call(fn () => app('rotate.captcha.file')->clear(3600))->hourly();
// 清理后返回剩余总数,请在诸如`Controller`或`artisan`中调用
app('rotate.captcha.file')->clear()->cost();
'paths' => ['api/*', 'sanctum/csrf-cookie', 'rotate.captcha*'],
'allowed_methods' => ['GET, POST, PATCH, PUT, OPTIONS'],
// 下面是本地调试的URL,根据生产环境修改
'allowed_origins' => ['http://localhost:8686', 'http://192.168.31.204:8686'],
'allowed_origins_patterns' => [],
'allowed_headers' => ['X-Captchatoken', 'X-Captchapolicie', 'X-Captchasid', 'X-Captchaticket'],
'exposed_headers' => ['X-Captchatoken'],
'max_age' => 0,
'supports_credentials' => true,
php artisan vendor:publish --provider="Levi\LaravelRotateCaptcha\CaptchaProvider"