1. Verification code type

Driver Digit Indicates a pure Digit verification code

Driver String Verification code

Driver Math Indicates the arithmetic verification code

Driver Chinese Indicates the Chinese verification code

Driver Audio Indicates the Audio verification code

Unable to upload audio, you can test yourself

2. Configure the verification code style

// The configuration is based on the verification code type
base64Captcha.DriverMath{
    Length:          4.// Verification code length
    Height:          30.// Captcha image height
    Width:           60.// Captcha image widthSource:"abcd".// Characters will appear
    NoiseCount:      0.// The number of interfering wordsDotCount:0.// The number of interference pointsMaxSkew:1.// The tilt Angle is 0-1
    ShowLineOptions: 2 | 4.// Number of lines
    BgColor: &color.RGBA{   // Background color
            R: 128,
            G: 98,
            B: 112,
            A: 0,
    },
    Fonts: []string{"3Dumb.ttf"},  / / fontLanguage:"zh".// Audio language
}
Copy the code

Method 3.

Generate store NewMemoryStore ()

NewCaptcha() creates a captcha instance

You need to pass in the draw parameters, along with the stroe

Generate() Draws a verification code

Returns base64 verification code, verification ID, and error information

Verify() parses the verification code

The verification code ID is passed in, and a Boolean value is returned when the verification code is entered