Socket
Book a DemoInstallSign in
Socket

github.com/zouhuigang/captcha

Package Overview
Dependencies
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

github.com/zouhuigang/captcha

Source
Go
Version
v0.0.0-20170715110218-f32d74c9bfd6
Version published
Created
Source

golang产生随机数,方面到处调用

用法:

package main

import (
	"fmt"
	"github.com/zouhuigang/captcha"
)

func main() {

	str := captcha.RandStr(6, captcha.NUM)
	fmt.Println("纯数字", str)

	str1 := captcha.RandStr(6, captcha.LOWER)
	fmt.Println("小写字母", str1)

	str2 := captcha.RandStr(6, captcha.UPPER)
	fmt.Println("大写字母", str2)

	str3 := captcha.RandStr(6, captcha.ALL)
	fmt.Println("混合", str3)
}

输出:

纯数字 166302
小写字母 bsgneq
大写字母 DCFTTS
混合 hNN4fN

再运行一次:

纯数字 716708
小写字母 xncquj
大写字母 CKNBDM
混合 D84yW2

更复杂的验证码,请用:

https://github.com/dchest/captcha

FAQs

Package last updated on 15 Jul 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts