We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
func login(w http.ResponseWriter, r *http.Request) { fmt.Println("method:", r.Method) //获取请求的方法 if r.Method == "GET" { t, _ := template.ParseFiles("login.gtpl") log.Println(t.Execute(w, nil)) } else { //请求的是登录数据,那么执行登录的逻辑判断 fmt.Println("username:", r.Form["username"]) fmt.Println("password:", r.Form["password"]) } }
缺少:
r.ParseForm()
所以函数打印的username与password一直为空。
username
password
The text was updated successfully, but these errors were encountered:
不好意思,没有看到这就是个错误例子。
Sorry, something went wrong.
No branches or pull requests
4.1 节代码
缺少:
所以函数打印的
username
与password
一直为空。The text was updated successfully, but these errors were encountered: