上一页 1 ··· 93 94 95 96 97 98 99 100 101 ··· 214 下一页
摘要: 一,得到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 刘宏缔的架构森林 阅读(81) 评论(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 刘宏缔的架构森林 阅读(172) 评论(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 刘宏缔的架构森林 阅读(340) 评论(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 刘宏缔的架构森林 阅读(70) 评论(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 刘宏缔的架构森林 阅读(97) 评论(0) 推荐(0)
摘要: 一,配置日志 在config/autoload/logger.php中增加一项对日志的配置: 'daily' => [ 'handler' => [ 'class' => Monolog\Handler\RotatingFileHandler::class, 'constructor' => [ ' 阅读全文
posted @ 2025-01-25 11:26 刘宏缔的架构森林 阅读(230) 评论(0) 推荐(0)
摘要: 一,创建controller $ php bin/hyperf.php gen:controller ImageController App\Controller\ImageController created successfully. 配置路由: Router::addGroup('/image 阅读全文
posted @ 2025-01-25 11:26 刘宏缔的架构森林 阅读(131) 评论(0) 推荐(0)
摘要: 一,安装第三方库 $ composer require hyperf/watcher --dev 二,配置 1,生成配置文件: $ php bin/hyperf.php vendor:publish hyperf/watcher [hyperf/watcher] publishes [config] 阅读全文
posted @ 2025-01-25 11:26 刘宏缔的架构森林 阅读(250) 评论(0) 推荐(0)
摘要: 一,查看帮助 $ php bin/hyperf.php help 二,查看可用的命令: $ php bin/hyperf.php 三,创建一个命令 $ php bin/hyperf.php gen:command DemoCommand 代码如下: <?php declare(strict_type 阅读全文
posted @ 2025-01-25 11:26 刘宏缔的架构森林 阅读(303) 评论(0) 推荐(0)
摘要: 一,报错信息: 1,代码: //根据id得到一条点击记录 func GetOnePicHitByPid(pid int64) (*model.HitsModel, error) { fields := []string{"id", "pid", "hits", "addtime"} plOne:=& 阅读全文
posted @ 2025-01-25 11:26 刘宏缔的架构森林 阅读(238) 评论(0) 推荐(0)
上一页 1 ··· 93 94 95 96 97 98 99 100 101 ··· 214 下一页