zoukankan      html  css  js  c++  java
  • web 服务

    package main
    import (
        "strings"
        "fmt"
        "net/http"
        "log"
    )
    func sayHelloName(w http.ResponseWriter, r *http.Request){
        r.ParseForm()
        fmt.Println(r.Form)
        fmt.Println("path: ", r.URL.Path)
        fmt.Println("scheme: ", r.URL.Scheme)
        fmt.Println(r.Form["url_long"])
        for k, v := range r.Form{
            fmt.Println("key: ", k)
            fmt.Println("val: ", strings.Join(v, " "))
        }
        fmt.Fprintf(w, "你好go")
    }
    
    func Start(){
        http.HandleFunc("/", sayHelloName)
        err := http.ListenAndServe(":9191", nil)
        if err != nil{
            log.Fatal("ListenAndServe: ", err)
        }
    }
    func main(){
        Start()
    }
    

      

    package main
    import (
        "strings"
        "fmt"
        "net/http"
        "log"
    )
    func sayHelloName(w http.ResponseWriter, r *http.Request){
        r.ParseForm()
        fmt.Println(r.Form)
        fmt.Println("path: ", r.URL.Path)
        fmt.Println("scheme: ", r.URL.Scheme)
        fmt.Println(r.Form["url_long"])
        for k, v := range r.Form{
            fmt.Println("key: ", k)
            fmt.Println("val: ", strings.Join(v, " "))
        }
        fmt.Fprintf(w, "你好go")
    }

    func Start(){
        http.HandleFunc("/", sayHelloName)
        err := http.ListenAndServe(":9191", nil)
        if err != nil{
            log.Fatal("ListenAndServe: ", err)
        }
    }
    func main(){
        Start()
    }


  • 相关阅读:
    angularjs $index用来取顺序
    angularjs &登录跳转
    if(!confirm("您确定删除吗?")){return;}
    登录跳转
    undefined null测试
    git生成密钥
    遍历map
    网络相关名词解释
    redis的Pub/Sub
    SQLAlchemy的使用
  • 原文地址:https://www.cnblogs.com/dqh123/p/12068464.html
Copyright © 2011-2022 走看看