• 2024-05-03go学习05
    gorm的使用typeUserstruct{ gorm.Model Namestring Ageint Sexbool}funcmain(){ db,err:=gorm.Open("mysql","root:password@/dbname?charset=utf8&parseTime=True&loc=Local") iferr!=nil{ panic("failedto
  • 2024-04-30go学习02
    get和post混合取参数 ginServer.POST("/post",func(c*gin.Context){ id:=c.Query("id") page:=c.DefaultQuery("page","0") name:=c.PostForm("name") message:=c.PostForm("message") fmt.P
  • 2024-04-30go学习01
    加载网页文件夹和加载静态资源文件路径:<linkrel="stylesheet"href="/static/css/style.css"><scriptsrc="/static/js/common.js"></script>//加载网页文件夹ginServer.LoadHTMLGlob("templates/*")//加载静态资源
  • 2024-04-24go学习00
    下载gin失败解决办法:cmd输入goenv-wGO111MODULE=ongoenv-wGOPROXY=https://goproxy.io,direct即可安装gin包gogetgithub.com/gin-gonic/gingoland中go.mod的require是灰色解决办法:即可愉快运行Demopackagemainimport( "github.com/gin-gonic/gin")func
  • 2024-03-16【Go语言】Gin框架
    1、导入包import"github.com/gin-gonic/gin"在浏览器中响应:2、RestfulApi3、响应前端//加载静态页面ginServer.LoadHTMLGlob("templates/*")//响应页面返回给前端ginServer.Get("index",func(context*gin.Context)){    //context.JSON()//json数
  • 2023-07-21Golang 中 Gin 框架开发学习记录 ——(二)
    4、响应页面  首先创建template文件夹将需要的hmtl文件放在里面,然后编写hmtl<!DOCTYPEhtml><htmllang="en"><head><metacharset="UTF-8"><title>我的GOweb页面</title><linkrel="stylesheet"href=&
  • 2023-07-21Golang中Gin框架开发学习记录——(一)
    1、环境配置    在GO语言中,使用"goget"命令获取相关包"goget"命令的作用与“gitclone”类似,这里使用:goget-ugithub.com/gin-gonic/gin来获取,相关代理问题可以参考以下链接:(19条消息)解决GO安装gin框架(goget-ugithub.com/gin-gonic/gin)超时问