close

package main

import (
    "fmt"
    "net/http"
)

func index(w http.ResponseWriter, r *http.Request) {
    fmt.Fprintf(w, "<h1>Hello %s!</h1><br><br><image src=/img/A.jpg />", r.URL.Path[1:])
}

func img(w http.ResponseWriter, r *http.Request) {
    http.ServeFile(w, r, r.URL.Path[1:])
}

func main() {
    http.HandleFunc("/", index)
    http.HandleFunc("/img/", img)
    http.ListenAndServe(":80", nil)
}










arrow
arrow
    全站熱搜
    創作者介紹
    創作者 黃彥霖 的頭像
    黃彥霖

    彥霖 實驗筆記

    黃彥霖 發表在 痞客邦 留言(0) 人氣()