上一页 1 ··· 30 31 32 33 34 35 36 37 38 ··· 40 下一页
摘要: package main import ( "fmt" "github.com/gin-gonic/gin" "net/http" "reflect" ) func main() { // 从 reader 读取数据 router := gin.Default() router.GET("/some 阅读全文
posted @ 2021-10-21 15:55 专职 阅读(155) 评论(0) 推荐(0) 编辑
摘要: 1. 单文件上传 package main import ( "fmt" "github.com/gin-gonic/gin" "log" ) func main() { router := gin.Default() //为 multipart forms 设置较低的内存限制 (默认是 32 Mi 阅读全文
posted @ 2021-10-20 16:30 专职 阅读(190) 评论(0) 推荐(0) 编辑
摘要: package main import ( "github.com/gin-gonic/gin" "github.com/gin-gonic/gin/testdata/protoexample" ) func main() { router := gin.Default() router.GET(" 阅读全文
posted @ 2021-10-20 15:39 专职 阅读(193) 评论(0) 推荐(0) 编辑
摘要: 使用 SecureJSON 防止 json 劫持。如果给定的结构是数组值或map,则默认预置 "while(1)," 到响应体。 package main import ( "github.com/gin-gonic/gin" ) func main() { router := gin.Defaul 阅读全文
posted @ 2021-10-20 14:49 专职 阅读(470) 评论(0) 推荐(0) 编辑
摘要: 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 阅读全文
posted @ 2021-10-20 14:22 专职 阅读(350) 评论(0) 推荐(0) 编辑
摘要: package main import ( "github.com/gin-gonic/gin" ) func main() { router := gin.Default() router.POST("/form_post", func(c *gin.Context) { // 接收post表单提 阅读全文
posted @ 2021-10-20 13:59 专职 阅读(125) 评论(0) 推荐(0) 编辑
摘要: package main import ( "fmt" "github.com/gin-gonic/gin" "net/http" ) type LoginForm struct { // form:"user" 表示前端提交form表单时User对应的key的名称为:user // binding 阅读全文
posted @ 2021-10-20 13:46 专职 阅读(140) 评论(0) 推荐(0) 编辑
摘要: package main import ( "github.com/gin-gonic/gin" "net/http" ) func main() { r := gin.Default() r.GET("/jsonp", func(context *gin.Context) { data := ma 阅读全文
posted @ 2021-10-20 11:12 专职 阅读(112) 评论(0) 推荐(0) 编辑
摘要: package main import ( "fmt" "io/fs" "io/ioutil" "os" "path" "path/filepath" ) func main() { // 文件和路径相关的功能包含了:os、path、filepath、ioutil包 // 1. 创建文件夹 // ( 阅读全文
posted @ 2021-10-17 11:48 专职 阅读(1294) 评论(0) 推荐(0) 编辑
摘要: package main import ( "fmt" "regexp" ) func main() { // 1. 根据字符串匹配 m1, _ := regexp.MatchString("foo.*", "seafood") fmt.Println(m1) // true m2, _ := re 阅读全文
posted @ 2021-10-16 19:20 专职 阅读(646) 评论(0) 推荐(0) 编辑
上一页 1 ··· 30 31 32 33 34 35 36 37 38 ··· 40 下一页