package main import ( "fmt" "github.com/gin-gonic/gin" ) func main() { engine := gin.Default() //http://localhost:8080/hello?name=davie engine.Handle("GET", "/hello", func(context *gin.Context) { path := context.FullPath() fmt.Println(path) name := context.DefaultQuery("name", "hello") fmt.Println(name) //输出 context.Writer.Write([]byte("hello," + name)) }) engine.Run() }