会员
众包
新闻
博问
闪存
赞助商
HarmonyOS
Chat2DB
所有博客
当前博客
我的博客
我的园子
账号设置
会员中心
简洁模式
...
退出登录
注册
登录
专职
博客园
首页
新随笔
联系
订阅
管理
上一页
1
···
30
31
32
33
34
35
36
37
38
···
40
下一页
2021年10月21日
gin中从reader读取数据数据
摘要: 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 专职
阅读(171)
评论(0)
推荐(0)
2021年10月20日
gin中的文件上传
摘要: 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 专职
阅读(212)
评论(0)
推荐(0)
gin中XML/JSON/YAML/ProtoBuf 渲染
摘要: 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 专职
阅读(207)
评论(0)
推荐(0)
gin中的SecureJSON 防止 json 劫持
摘要: 使用 SecureJSON 防止 json 劫持。如果给定的结构是数组值或map,则默认预置 "while(1)," 到响应体。 package main import ( "github.com/gin-gonic/gin" ) func main() { router := gin.Defaul
阅读全文
posted @ 2021-10-20 14:49 专职
阅读(546)
评论(0)
推荐(0)
gin中的query和postform用法
摘要: 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 专职
阅读(385)
评论(0)
推荐(0)
gin中multipart/urlencoded表单
摘要: 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 专职
阅读(135)
评论(0)
推荐(0)
gin中multipart/urlencoded绑定
摘要: 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 专职
阅读(162)
评论(0)
推荐(0)
gin中jsonp的用法
摘要: 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 专职
阅读(125)
评论(0)
推荐(0)
2021年10月17日
golang中文件和路径用法
摘要: 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 专职
阅读(1385)
评论(0)
推荐(0)
2021年10月16日
golang中的正则表达式
摘要: 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 专职
阅读(665)
评论(0)
推荐(0)
上一页
1
···
30
31
32
33
34
35
36
37
38
···
40
下一页
公告