validate.go 223 Bytes EditWeb IDE 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 package utils import ( "regexp" ) //检查手机号格式 func CheckPhoneNo(phone_no string)(bool) { reg := `^1\d{10}$` rgx := regexp.MustCompile(reg) if (!rgx.MatchString(phone_no)) { return false } return true }