01 2025 档案
摘要:一,代码 1,global/validator.go package global import "github.com/go-playground/validator/v10" //存放GetMessages()方法 type Validator interface { GetMessages()
阅读全文
摘要:一,安装第三方库: $ go get -u github.com/go-playground/validator/v10 go: downloading github.com/go-playground/validator/v10 v10.24.0 go: downloading github.co
阅读全文
摘要:一,得到get参数 1,代码: //得到列表 func (ic *ImageController) List(c *gin.Context) { // 不带缺省值 a := c.Query("a") // 带缺省值 d := c.DefaultQuery("d", "dd") fmt.Println
阅读全文
摘要:一,安装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
阅读全文
摘要:一,代码: 1,routes/route.go package routes import ( "fmt" "github.com/gin-gonic/gin" "imagebank/controller" "imagebank/global" "runtime/debug" "time" ) fu
阅读全文
摘要:一,目录结构: 二,代码: 1,controller/ImageController.go package controller import ( "github.com/gin-gonic/gin" "net/http" ) type ImageController struct{} func N
阅读全文
摘要:一,创建项目 创建目录: $ mkdir imagebank $ cd imagebank/ 创建项目: $ go mod init imagebank go: creating new go.mod: module imagebank 引入gin第三方库 liuhongdi@lhdpc:/data
阅读全文
摘要:一,配置日志 在config/autoload/logger.php中增加一项对日志的配置: 'daily' => [ 'handler' => [ 'class' => Monolog\Handler\RotatingFileHandler::class, 'constructor' => [ '
阅读全文
摘要:一,创建controller $ php bin/hyperf.php gen:controller ImageController App\Controller\ImageController created successfully. 配置路由: Router::addGroup('/image
阅读全文
摘要:一,安装第三方库 $ composer require hyperf/watcher --dev 二,配置 1,生成配置文件: $ php bin/hyperf.php vendor:publish hyperf/watcher [hyperf/watcher] publishes [config]
阅读全文
摘要:一,查看帮助 $ php bin/hyperf.php help 二,查看可用的命令: $ php bin/hyperf.php 三,创建一个命令 $ php bin/hyperf.php gen:command DemoCommand 代码如下: <?php declare(strict_type
阅读全文
摘要:一,报错信息: 1,代码: //根据id得到一条点击记录 func GetOnePicHitByPid(pid int64) (*model.HitsModel, error) { fields := []string{"id", "pid", "hits", "addtime"} plOne:=&
阅读全文
摘要:一,官网: https://www.hyperf.io/ 二,安装: composer create-project hyperf/hyperf-skeleton 问到的一些问题和我的设置: Creating a "hyperf/hyperf-skeleton" project at "./hype
阅读全文
摘要:一,安装fresh库 $ go get github.com/pilu/fresh 二,遇到问题: 执行fresh时报错: $ fresh fresh:未找到命令 解决: $ go install github.com/pilu/fresh@latest 再次执行: $ go get github.
阅读全文
摘要:一,官网: 官方文档: https://pkg.go.dev/github.com/go-playground/validator/v10 代码地址: https://github.com/go-playground/validator 二、常用标记说明 标记 标记说明 例 required 必填
阅读全文
摘要:一,查看帮助: $ php start.php help Usage: php yourfile <command> [mode] Commands: start Start worker in DEBUG mode. Use mode -d to start in DAEMON mode. sto
阅读全文
摘要:一,配置时报错: 1,报错 configure: error: Package requirements (xpm) were not met: Package 'xpm', required by 'virtual:world', not found 解决: [root@blog ~]# dnf
阅读全文
摘要:一,报错代码: // 验证码长度 $length = 4; // 包含哪些字符 $chars = '0123456789abcefghijklmnopqrstuvwxyz'; $builder = new PhraseBuilder($length, $chars); $captcha = new
阅读全文
摘要:一,相关文档 https://www.workerman.net/doc/webman/plugin/console.html 二,创建一个空的命令行程序 1,用webman命令创建 $ php webman make:command StatMonthCommand Make command St
阅读全文
摘要:一,thinkphp默认忽略/vendor目录 默认的.gitignore文件: *.log .env composer.phar composer.lock .DS_Store Thumbs.db /.idea /.vscode /vendor /.settings /.buildpath /.p
阅读全文
摘要:一,git项目管理端添加项目:(gitolite) # vi gitolite.conf # git add -A # git commit -m "add a project:lhdadm"; # git push origin master 二,客户端初始化项目 1, 先创建项目 $ git i
阅读全文