跳转到正文
技术笔记与独立作品

把折腾的过程,
写成有用的经验。

从后端到前端,从部署到 AI。
记录真实的开发实践,分享解决问题的思路。

我在记录PHP / GolangWeb 开发Docker / 运维AI 实践

最新笔记.

258 篇记录,持续积累
Backend2 分钟

php 使用 grpc

前提 protoc(the protobuf compiler binary to generate PHP classes for your messages and service definition.) grpc_php_plugin(a plugin for protoc to generate the se…

2,251 次阅读
阅读全文
go2 分钟

alpine容器中运行go的二进制文件

问题重现 /data # ls app /data # ./app /bin/sh: ./app: not found 解决办法 方法一 查看下依赖库 /data # ldd app /lib64/ld-linux-x86-64.so.2 (0x7ff4fc486000) libpthread.so.0 => /lib…

3,443 次阅读
阅读全文
go5 分钟

gin config

这里我选择json文件作为项目的配置文件 { "app_name": "app", "app_model": "debug", "app_host": "aa.com", "app_port": "8097", "database": { "dsn": "root:@tcp(docker-mysql:3306)/tes…

2,609 次阅读
阅读全文
go19 分钟

gorm 基本操作

type Test struct { Id int `json:"id"` Name string `json:"name"` Memo string `json:"memo"` CreateTime string `json:"create_time"` UpdateTime string `json:"update…

2,615 次阅读
阅读全文
go1 分钟

go 数字和字符串相互转换

字符串转数字 方法1 userId := "100" userId2, _ := strconv.Atoi(userId) //如果userId不是数字字符串,结果为0 方法2 //golang strconv.ParseInt 是将字符串转换为数字的函数,功能灰常之强大. //参数1 数字的字符串形式 //参数2 数…

2,530 次阅读
阅读全文
go2 分钟

go gin封装redis

封装 package cache import ( "fmt" "github.com/go-redis/redis" "time" ) var RedisClient *redis.Client func InitRedis() { RedisClient = redis.NewClient(&redis.Optio…

2,818 次阅读
阅读全文
go3 分钟

go gin 封装gorm

封装 package db import ( "fmt" "gorm.io/driver/mysql" "gorm.io/gorm" ) var Db *gorm.DB func init() { var err error dsn := "root:@tcp(127.0.0.1:3306)/test?charset=…

3,166 次阅读
阅读全文
go3 分钟

go gin上传文件

multipart/form-data func Upload(c *gin.Context) { file, err := c.FormFile("file") if err != nil { c.String(500, "上传图片出错") } extName := path.Ext(file.Filename) a…

2,239 次阅读
阅读全文
php1 分钟

laravel 调试工具

Laravel-debugbar 可以打印出每个请求执行的sql 安装 composer require barryvdh/laravel-debugbar 执行完即可,打开任一html页面(返回json的不行) 更详细的说明请参考: https://github.com/barryvdh/laravel-debugb…

2,990 次阅读
阅读全文