摘要:
package main import ( "fmt" "github.com/gin-gonic/gin" "net/http" "reflect" ) func main() { // 从 reader 读取数据 router := gin.Default() router.GET("/some 阅读全文
摘要:
1. 单文件上传 package main import ( "fmt" "github.com/gin-gonic/gin" "log" ) func main() { router := gin.Default() //为 multipart forms 设置较低的内存限制 (默认是 32 Mi 阅读全文
摘要:
package main import ( "github.com/gin-gonic/gin" "github.com/gin-gonic/gin/testdata/protoexample" ) func main() { router := gin.Default() router.GET(" 阅读全文
摘要:
使用 SecureJSON 防止 json 劫持。如果给定的结构是数组值或map,则默认预置 "while(1)," 到响应体。 package main import ( "github.com/gin-gonic/gin" ) func main() { router := gin.Defaul 阅读全文
摘要:
package main import ( "github.com/gin-gonic/gin" ) func main() { r := gin.Default() // Query和PostForm r.GET("/post", func(c *gin.Context) { id := c.Qu 阅读全文
摘要:
package main import ( "github.com/gin-gonic/gin" ) func main() { router := gin.Default() router.POST("/form_post", func(c *gin.Context) { // 接收post表单提 阅读全文
摘要:
package main import ( "fmt" "github.com/gin-gonic/gin" "net/http" ) type LoginForm struct { // form:"user" 表示前端提交form表单时User对应的key的名称为:user // binding 阅读全文
摘要:
package main import ( "github.com/gin-gonic/gin" "net/http" ) func main() { r := gin.Default() r.GET("/jsonp", func(context *gin.Context) { data := ma 阅读全文
摘要:
package main import ( "fmt" "io/fs" "io/ioutil" "os" "path" "path/filepath" ) func main() { // 文件和路径相关的功能包含了:os、path、filepath、ioutil包 // 1. 创建文件夹 // ( 阅读全文
摘要:
package main import ( "fmt" "regexp" ) func main() { // 1. 根据字符串匹配 m1, _ := regexp.MatchString("foo.*", "seafood") fmt.Println(m1) // true m2, _ := re 阅读全文