<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                ??碼云GVP開源項目 12k star Uniapp+ElementUI 功能強大 支持多語言、二開方便! 廣告
                模板渲染存儲文件 (index.html同模板渲染終端index.html保持不變) ~~~ package main import ( "os" "fmt" "html/template" // "io" "net/http" ) var myTemplate *template.Template type Person struct { Name string age string } func userInfo(w http.ResponseWriter,r *http.Request) { p := Person{Name:"Murphy",age:"28"} myTemplate.Execute(os.Stdout,p) file,err := os.OpenFile("demo.dat", os.O_CREATE|os.O_WRONLY, 0755) if err != nil { fmt.Println("open failed err:", err) return } myTemplate.Execute(file,p) } func initTemplate(fileName string) (err error){ myTemplate,err = template.ParseFiles(fileName) if err != nil{ fmt.Println("parse file err:",err) return } return } /* func HandleFunc(pattern string, handler func(ResponseWriter, *Request)) { DefaultServeMux.HandleFunc(pattern, handler) } */ func main() { initTemplate("./index.html") http.HandleFunc("/user/info", userInfo) err := http.ListenAndServe("0.0.0.0:8880", nil) if err != nil { fmt.Println("http listen failed") } } ~~~ 命令行: $ go run main.go 然后在瀏覽器中輸入 : http://localhost:8880/user/info 命令行顯示: ~~~ <html> <head> <title> </title> </head> <body> <p> hello,Murphy {Murphy 28} </p> </body> </html> ~~~ 命令行: control+c ^Csignal: interrupt $ ls demo.dat index.html main.go $ cat demo.dat ~~~ <html> <head> <title> </title> </head> <body> <p> hello,Murphy {Murphy 28} </p> </body> ~~~
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看