captcha

package
v1.3.9 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 30, 2023 License: Apache-2.0 Imports: 3 Imported by: 0

README

一、图形验证码的生成

package main

import "github.com/daimayun/go/captcha"

// CreateCaptcha 生成图形验证码[默认为数字验证码]
func CreateCaptcha() (id, b64s string, err error) {
	var captchaDriver captcha.NewCaptchaDrivers
	return captcha.GetCaptcha(captchaDriver)
}

// CheckCaptcha 校验验证码
func CheckCaptcha(id, value string) bool {
	return captcha.VerifyCaptcha(id, value)
}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetCaptcha

func GetCaptcha(driverData NewCaptchaDrivers) (id, b64s string, err error)

GetCaptcha 获取图形验证码

func VerifyCaptcha

func VerifyCaptcha(id, value string, clears ...bool) (res bool)

VerifyCaptcha 校验图形验证码[clears[true:验证通过后删除,false:永不删除]]

Types

type NewCaptchaDrivers

type NewCaptchaDrivers struct {
	Type            string
	Height          int
	Width           int
	NoiseCount      int
	ShowLineOptions int
	Language        string
	Length          int
	Source          string
	BgColor         *color.RGBA

	Fonts []string
	// contains filtered or unexported fields
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL