go-zero 生成验证码

 验证码包:github.com/mojocn/base64Captcha

var driver = &base64Captcha.DriverString{
		Length:          4,
		Height:          60,
		Width:           240,
		ShowLineOptions: 6,
		Source:          "1234567890qwertyuioplkjhgfdsazxcvbnm",
	}
	var store = base64Captcha.DefaultMemStore
	c := base64Captcha.NewCaptcha(driver, store)
	_, b64s, code, errs := c.Generate()
	if errs != nil {
		return "", errors.New(errs.Error())
	}

会生成图片(b64s)、真实验证码(code)

你可能感兴趣的:(golang,go-zero,验证码)