|
|
|
@ -41,8 +41,20 @@ func login(w http.ResponseWriter, r *http.Request) {
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
//请求的是登陆数据,那么执行登陆的逻辑判断
|
|
|
|
|
fmt.Println("username:", r.Form["username"])
|
|
|
|
|
fmt.Println("password:", r.Form["password"])
|
|
|
|
|
fmt.Println("username:", r.Form["username"][0])
|
|
|
|
|
fmt.Println("password:", r.Form["password"][0])
|
|
|
|
|
fmt.Println("age:", r.Form["age"][0])
|
|
|
|
|
if len(r.Form["username"][0]) == 0 {
|
|
|
|
|
//为空的处理
|
|
|
|
|
fmt.Println("username is empty!!!")
|
|
|
|
|
}
|
|
|
|
|
getint, err := strconv.Atoi()(r.Form.Get("age"))
|
|
|
|
|
if err != nil {
|
|
|
|
|
fmt.Println("this is an error")
|
|
|
|
|
}
|
|
|
|
|
if getint > 100 {
|
|
|
|
|
fmt.Println("too old")
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|