Golang-----创建处理器

// 创建多处理器的函数
func handle(w http.ResponseWriter, r *http.Request) {

	fmt.Fprintln(w, "net/http web", r.URL.Path)
}

func main() {

	//映射的路径
	http.HandleFunc("/",handle)
	// 路由
	http.ListenAndServe(":8000",nil)
}

 

おすすめ

転載: blog.csdn.net/qq_35361859/article/details/103760566