go语言静态 html访问

package main

import (
	"html/template"
	"log"
	"net/http"
)

func main() {
	port := "80"

	http.HandleFunc("/baidu_verify_Hbvw7qAUmJ.html", func(res http.ResponseWriter, req *http.Request) {
		t, err := template.ParseFiles("baidu_verify_Hbvw7qAUmJ.html")
		if err != nil {
			log.Println("err:",err)
			return
		}
		t.Execute(res, nil)
	})
	
	http.ListenAndServe(":"+port, nil)
}

 

如上示例:127.0.0.1//baidu_verify_Hbvw7qAUmJ.html

百度搜索资源平台 文件验证

 

 

阿里云,做网站的好去处:

https://promotion.aliyun.com/ntms/yunparter/invite.html?userCode=qo79yvz1

你可能感兴趣的:(go,html)