gpt4 book ai didi

golang 打印 echo.Context 值

转载 作者:IT王子 更新时间:2023-10-29 02:22:21 25 4
gpt4 key购买 nike

我是 Go 的新手,正在尝试检查方法参数。我有以下代码

func (c *controller) OrderNew(ctx echo.Context) error {

当我尝试其中之一时:

    fmt.println(ctx)
fmt.Printf("%v \n", ctx)

我明白了

&{0xc4200f21e0 0xc4202302d0 /order [] [] map[] 0x4092860 map[site_key:2] 0xc4200bb6c0}

我意识到 *controller 是一个指针,返回的值包含地址,但不确定如何真正调试或进一步检查。我还看到在 cxt 上调用的函数,如

ctx.Get and ctx.Render

我意识到这是 echo.Context 中的函数

如有任何帮助/说明,我们将不胜感激。谢谢!

最佳答案

关于golang 打印 echo.Context 值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42164203/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com