Merge pull request #1089 from run6/master

邮箱验证的正则有误
This commit is contained in:
astaxie
2019-05-20 22:18:12 +08:00
committed by GitHub
2 changed files with 3 additions and 3 deletions

View File

@@ -64,7 +64,7 @@ if m, _ := regexp.MatchString("^[a-zA-Z]+$", r.Form.Get("engname")); !m {
你想知道用户输入的一个Email地址是否正确通过如下这个方式可以验证
```Go
if m, _ := regexp.MatchString(`^([\w\.\_]{2,10})@(\w{1,}).([a-z]{2,4})$`, r.Form.Get("email")); !m {
if m, _ := regexp.MatchString(`^([\w\.\_]{2,10})@(\w{1,})\.([a-z]{2,4})$`, r.Form.Get("email")); !m {
fmt.Println("no")
}else{
fmt.Println("yes")

View File

@@ -184,14 +184,14 @@ orm.SetMaxOpenConns("default", 30)
```Go
type Userinfo struct {
Uid int `PK` //如果表的主键不是id那么需要加上pk注释显式的说这个字段是主键
Uid int `orm:"PK"` //如果表的主键不是id那么需要加上pk注释显式的说这个字段是主键
Username string
Departname string
Created time.Time
}
type User struct {
Uid int `PK` //如果表的主键不是id那么需要加上pk注释显式的说这个字段是主键
Uid int `orm:"PK"` //如果表的主键不是id那么需要加上pk注释显式的说这个字段是主键
Name string
Profile *Profile `orm:"rel(one)"` // OneToOne relation
Post []*Post `orm:"reverse(many)"` // 设置一对多的反向关系