phone

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Nov 16, 2025 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ParsePhone

func ParsePhone(mobile string) (countryCode, regionCode, nationalNumber string, isValidNumber bool)

ParsePhone 将"1234567"这样的电话号码解析出国家代码等信息。mobile不能带"+"。 countryCode: 1 regionCode: CA, US等 nationalNumber (778) 778-7878

Types

type Phone added in v1.0.1

type Phone struct {
	CountryCode    string `json:"country_code"`    // 例如:1
	RegionCode     string `json:"region_code"`     // 例如:ca, us
	NationalNumber string `json:"national_number"` // 例如:(778) 778-7878
	IsValidNumber  bool   `json:"is_valid_number"` // 是否有效的电话号码:true, false
}

Phone 带有国家码的电话信息

type Twilio

type Twilio struct {
	AccountSID  string
	AuthToken   string
	PhoneNumber string // 格式:+17781231234
}

func (*Twilio) SendSMSByTwilio

func (twilio *Twilio) SendSMSByTwilio(numberTo string, message string)

https://www.twilio.com/blog/2017/09/send-text-messages-golang.html SendSMS 通过twilio发一个手机短信

Jump to

Keyboard shortcuts

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