validate.go 318 B

1234567891011121314151617181920
  1. package libs
  2. import "regexp"
  3. type IValidate struct {
  4. }
  5. func Validate() (*IValidate) {
  6. return new(IValidate)
  7. }
  8. // 验证手机号码
  9. func (*IValidate)IsPhone(phone string)(bool) {
  10. regular := "^(13[0-9]|14[57]|15[0-35-9]|18[07-9])\\\\d{8}$"
  11. reg := regexp.MustCompile(regular)
  12. return reg.MatchString(phone)
  13. }