# think-captcha **Repository Path**: bnb930125/think-captcha ## Basic Information - **Project Name**: think-captcha - **Description**: 用于thinkphp的图形验证码 - **Primary Language**: Unknown - **License**: Apache-2.0 - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2025-05-27 - **Last Updated**: 2025-05-30 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # think-captcha thinkphp 验证码类,基于 thinkphp 官方 think-captcha 修改。用于前后端分离项目,用 cookie 保存 captcha 信息,不依赖 session 。\ 修改了图片生成算法。更换了字体。\ 代码仓库: https://gitee.com/bnb930125/think-captcha.git ## 安装 > composer require bnb930125/think-captcha ## 使用 #### 在控制器中输出验证码 ```php public function captcha() { return captcha(); } ``` #### 校验验证码 ```php if(!captcha_check($input)){ //验证码错误 } ``` #### API 方式使用 ```php use bnb930125\captcha\facade\Captcha; // 输出 $captchaInfo = Captcha::create(null, true); // $captchaInfo['img'] 包含 base64 格式图片信息。 // 检验 if(!Captcha::check($input,$captchaInfo['hash'])){ // 验证码错误 } ```