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
package main import ( "fmt" "net/http" "strings" "log" ) func sayHelloName(w http.ResponseWriter, r *http.Request) { r.ParseForm() // 解析参数 fmt.Println(r.Form) // 输出到服务端的打印信息 fmt.Println("path", r.URL.Path) fmt.Println("scheme", r.URL.Scheme) fmt.Println(r.Form["url_long"]) for k, v := range r.Form { fmt.Println("key: ", k) fmt.Println("val: ", strings.Join(v, "")) } fmt.Fprintf(w, "Hello World") // 写入到 w 输出到客户端 } func main() { http.HandleFunc("/", sayHelloName) // 设置访问路由 err := http.ListenAndServe(":9090", nil) // 设置监听端口 if err != nil { log.Fatal("ListenAndServer: ", err) } }
The text was updated successfully, but these errors were encountered:
No branches or pull requests
The text was updated successfully, but these errors were encountered: