依赖 github.com/mojocn/base64Captcha 官方预览 实现 import ( cp github.com/mojocn/base64Captcha image/color ) type captcha struct { c *cp.Captcha } //创建字符串验证码实例 func NewCaptcha(height, width, length int, source string) *captcha { driver := cp.NewDriverString(height, width, 0, cp.OptionShowHollo