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)
}
全站熱搜