PHPackages                             watsonhaw/think-captcha - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. watsonhaw/think-captcha

ActiveLibrary

watsonhaw/think-captcha
=======================

captcha package for thinkphp

00PHPCI passing

Since Jul 28Pushed todayCompare

[ Source](https://github.com/watsonhaw5566/think-captcha)[ Packagist](https://packagist.org/packages/watsonhaw/think-captcha)[ RSS](/packages/watsonhaw-think-captcha/feed)WikiDiscussions main Synced today

READMEChangelogDependenciesVersions (1)Used By (0)

think-captcha
=============

[](#think-captcha)

> ThinkPHP 验证码扩展

本扩展提供 **两种验证码实现**，按你的项目场景选择：

类存储策略适用场景`CaptchaService`（**推荐**）`Cache + Key`前后端分离、跨域、SPA、小程序、App、分布式多节点`Captcha`（传统类）`Session`单体项目、传统服务端渲染、和 ThinkPHP Session 深度绑定`CaptchaService` 只做三件事 —— 生成、校验、删除 —— **返回纯数据**，路由 / 响应格式 / CORS / 限流 均由你在业务控制器里自行掌控，灵活度最高。

---

安装
--

[](#安装)

```
composer require watsonhaw/think-captcha
```

> 环境要求：
>
> - PHP &gt;= 7.4（推荐 PHP 8+）
> - 启用 GD 扩展（`ext-gd`）、Mbstring（`ext-mbstring`）
> - ThinkPHP 6.0 / 8.0 通用

安装后会自动注册服务（`extra.think`），配置文件会被发布到 `config/captcha.php`。

---

5 分钟上手
------

[](#5-分钟上手)

### 1. 在你自己的业务控制器里写两个方法

[](#1-在你自己的业务控制器里写两个方法)

```
