feat: 新增验证码接口
This commit is contained in:
@@ -1,14 +0,0 @@
|
||||
<?php
|
||||
declare (strict_types = 1);
|
||||
|
||||
namespace app\admin\controller;
|
||||
|
||||
use think\View;
|
||||
|
||||
class Index
|
||||
{
|
||||
public function index()
|
||||
{
|
||||
return '您好!这是一个[admin]示例应用';
|
||||
}
|
||||
}
|
||||
21
app/admin/controller/v1/Captcha.php
Normal file
21
app/admin/controller/v1/Captcha.php
Normal 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"]);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user