```go
package main
import (
"net/http"
"fmt"
"strconv"
)
var writera http.ResponseWriter
var i int64 = 0
func main() {
http.HandleFunc("/", func(writer http.ResponseWriter,
request *http.Request) {
fmt.Println("请求:", (i))
i++
writera = writer
name := request.FormValue("name")
outHtml("name=" + name)
})
port2 := 82
fmt.Println("http://localhost:" + strconv.Itoa(port2))
http.ListenAndServe(":"+strconv.Itoa(port2), nil)
}
func outHtml(c ...interface{}) {
for _, v := range c {
fmt.Fprintln(writera, v)
fmt.Println()
}
}
```
更多评论