RuoYi framework analysis of the basics ⑤-verification code operation processing

1. Verification code type

application.yml

# 项目相关配置
ruoyi:
  # 验证码类型 math 数组计算 char 字符验证
  captchaType: math
  • math: Mathematical calculation (according to the picture, enter the result of addition, subtraction, multiplication, and division)
  • char: character verification (according to the picture, enter the characters shown in the picture)

If you choose math according to the separate version

Two, generate verification code

  • Generate uuid
  • Prefix + uuid = verification code key
  • captchaProducerMath.createText()Generate a string
    • String with @ as the split point
    • @Before is the calculation formula
    • @Following is the calculation result
  • Generate pictures according to calculation formula

Guess you like

Origin blog.csdn.net/kangweijian/article/details/115058654