Documentation
¶
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CreateB64 ¶
CreateB64 创建验证码,返回图片base64
Example ¶
package main
import (
"fmt"
"github.com/mulan-ext/captcha"
"github.com/mulan-ext/captcha/equation"
)
func init() {
captcha.SetGlobal(equation.NewEquation(2))
}
func main() {
id, result, data, err := captcha.CreateB64()
if err != nil {
fmt.Println(err)
return
}
fmt.Println(id)
fmt.Println(data)
if ok, _ := captcha.Check(id, "xxxx"); ok {
fmt.Println("test check")
} else if ok, _ := captcha.Check(id, result); ok {
fmt.Println("ok")
} else {
fmt.Println("fail")
}
}
Output:
func CreateBytes ¶
CreateBytes 创建验证码,返回图片数据[]byte
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.