package main

import (
"log"
"net/http"
)

func main() {
http.HandleFunc("/", handler)
http.ListenAndServe(":8081", nil)
}

func handler(w http.ResponseWriter, r *http.Request) {

keys, ok := r.URL.Query()["key"]

if !ok || len(keys) < 1 {
	log.Println("Url Param 'key' is missing")
	return
}

// Query()["key"] will return an array of items,
// we only want the single item.
key := keys[0]

log.Println("Url Param 'key' is: " + string(key))

}

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-06-02
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-09-26
  • 2022-12-23
猜你喜欢
  • 2021-05-28
  • 2021-12-18
  • 2021-06-17
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案