上一页 1 ··· 57 58 59 60 61 62 63 64 65 ··· 178 下一页
摘要: 一,配置 config/autoload/exceptions.php <?php declare(strict_types=1); /** * This file is part of Hyperf. * * @link https://www.hyperf.io * @document http 阅读全文
posted @ 2025-02-09 19:15 刘宏缔的架构森林 阅读(159) 评论(1) 推荐(0)
摘要: 一,安装第三方库: $ go get -u gorm.io/gorm go: added github.com/jinzhu/inflection v1.0.0 go: added github.com/jinzhu/now v1.1.5 go: added gorm.io/gorm v1.25.1 阅读全文
posted @ 2025-02-02 12:38 刘宏缔的架构森林 阅读(86) 评论(0) 推荐(0)
摘要: 一,代码 1,global/validator.go package global import "github.com/go-playground/validator/v10" //存放GetMessages()方法 type Validator interface { GetMessages() 阅读全文
posted @ 2025-01-31 17:39 刘宏缔的架构森林 阅读(235) 评论(0) 推荐(0)
摘要: 一,安装第三方库: $ go get -u github.com/go-playground/validator/v10 go: downloading github.com/go-playground/validator/v10 v10.24.0 go: downloading github.co 阅读全文
posted @ 2025-01-31 15:02 刘宏缔的架构森林 阅读(50) 评论(0) 推荐(0)
摘要: 一,得到get参数 1,代码: //得到列表 func (ic *ImageController) List(c *gin.Context) { // 不带缺省值 a := c.Query("a") // 带缺省值 d := c.DefaultQuery("d", "dd") fmt.Println 阅读全文
posted @ 2025-01-31 13:04 刘宏缔的架构森林 阅读(57) 评论(0) 推荐(0)
摘要: 一,安装zap $ go get -u go.uber.org/zap go: downloading go.uber.org/zap v1.27.0 go: downloading go.uber.org/multierr v1.10.0 go: downloading go.uber.org/m 阅读全文
posted @ 2025-01-31 10:55 刘宏缔的架构森林 阅读(138) 评论(0) 推荐(0)
摘要: 一,代码: 1,routes/route.go package routes import ( "fmt" "github.com/gin-gonic/gin" "imagebank/controller" "imagebank/global" "runtime/debug" "time" ) fu 阅读全文
posted @ 2025-01-30 19:56 刘宏缔的架构森林 阅读(256) 评论(0) 推荐(0)
摘要: 一,目录结构: 二,代码: 1,controller/ImageController.go package controller import ( "github.com/gin-gonic/gin" "net/http" ) type ImageController struct{} func N 阅读全文
posted @ 2025-01-29 22:00 刘宏缔的架构森林 阅读(38) 评论(0) 推荐(0)
摘要: 一,创建项目 创建目录: $ mkdir imagebank $ cd imagebank/ 创建项目: $ go mod init imagebank go: creating new go.mod: module imagebank 引入gin第三方库 liuhongdi@lhdpc:/data 阅读全文
posted @ 2025-01-29 16:01 刘宏缔的架构森林 阅读(63) 评论(0) 推荐(0)
摘要: 一,配置日志 在config/autoload/logger.php中增加一项对日志的配置: 'daily' => [ 'handler' => [ 'class' => Monolog\Handler\RotatingFileHandler::class, 'constructor' => [ ' 阅读全文
posted @ 2025-01-25 11:26 刘宏缔的架构森林 阅读(181) 评论(0) 推荐(0)
上一页 1 ··· 57 58 59 60 61 62 63 64 65 ··· 178 下一页