# 验证码
# 引入maven 包
<dependency>
<groupId>com.fast4cloud</groupId>
<artifactId>framework-starter-captcha</artifactId>
</dependency>
1
2
3
4
2
3
4
TIP
- 直接引入maven 即可,
- 用法
- 在yml 配置信息如下 :::
##验证码
kaptcha:
config:
# 边框,默认无边框
border: 'no'
#边框颜色
borderColor: 105,179,90
# 字体颜色
fontColor: black
#字体大小
fontSize: 30
#
fontNames: 宋体,楷体,微软雅黑
# 文本间隔
contentSpace: 3
# 文档长度
contentLength: 4
# 验证码宽度
imageWidth: 110
#验证码高度
imageHeight: 40
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# 使用
@Autowired
FastKaptchaService fastKaptchaService
//调用方法
CaptchaVO captchaVO= fastKaptchaService.getKaptchaText();
//获取缓存key,根据验证码传入.生成一个md5后的加密key,方便调用传输
fastKaptchaService.getCacheKey(String captchaKey);
1
2
3
4
5
6
7
2
3
4
5
6
7
# **CaptchaVO属性描述 **
/**
* 验证码标识符
*/
private String captchaKey;
/**
* base64字符串
*/
private String base64Img;
/**
* 验证码过期时间,秒
*/
private Long expire;
1
2
3
4
5
6
7
8
9
10
11
12
13
2
3
4
5
6
7
8
9
10
11
12
13