1. Go to this page and download the library: Download wpjscc/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/ */
use Captcha\Contracts\FileDriverInterface;
class OssFileDriver implements FileDriverInterface
{
public function files(string $directory): array { /* 返回目录下所有文件绝对路径 */ }
public function exists(string $path): bool { /* ... */ }
public function read(string $path): string { /* ... */ }
public function write(string $path, string $contents): bool { /* ... */ }
public function delete(string $path): bool { /* ... */ }
public function makeDirectory(string $path, int $mode = 0755): bool { /* ... */ }
}
use Captcha\Contracts\StorageInterface;
class RedisStorage implements StorageInterface
{
public function putSession(string $sessionId, array $data): void { /* ... */ }
public function getSession(string $sessionId): ?array { /* ... */ }
public function removeSession(string $sessionId): void { /* ... */ }
public function hasSession(string $sessionId): bool { /* ... */ }
public function putCache(string $key, string $value, int $ttl): void { /* ... */ }
public function pullCache(string $key): ?string { /* ... */ }
}