feat: 新增验证码接口

This commit is contained in:
2024-12-31 18:05:45 +08:00
parent b210b95988
commit a3d160b873
5 changed files with 68 additions and 17 deletions

View File

@@ -0,0 +1,21 @@
<?php
declare (strict_types = 0);
namespace app\admin\controller\v1;
use think\facade\Config;
class Captcha
{
/**
* 获取验证码
*/
public function index(\think\Config $config, \think\Session $session)
{
// 输出验证码
$captcha = new \think\captcha\Captcha($config, $session);
$data = $captcha->create();
return success('获取验证码成功!', $data["img"]);
}
}