du9757 2014-11-04 07:16
浏览 41

获取Revel控制器以返回cookie

I've been able to store a custom cookie but I'm trying to save it for a session the store it in the database when a form is submitted. I use:

func (c Application) Index(id string) revel.Result {
cookie := http.Cookie{Name: "id", Value: id, Domain: "localhost", Path: "/"}
c.SetCookie(&cookie)
return c.Render()
}

but I cannot access it again. How could I retrieve it in a different function?

Thank you!

  • 写回答

1条回答 默认 最新

  • doqw89029 2014-11-11 06:29
    关注

    I was going about it all wrong. Revel sets cookies with Session

    Set: c.Session[key] = value

    Get: c.Session[key]

    评论

报告相同问题?

悬赏问题

  • ¥15 不同系统编译兼容问题
  • ¥100 三相直流充电模块对数字电源芯片在物理上它必须具备哪些功能和性能?
  • ¥30 数字电源对DSP芯片的具体要求
  • ¥20 antv g6 折线边如何变为钝角
  • ¥30 如何在Matlab或Python中 设置饼图的高度
  • ¥15 nginx中的CORS策略应该如何配置
  • ¥30 信号与系统实验:采样定理分析
  • ¥100 我想找人帮我写Python 的股票分析代码,有意请加mathtao
  • ¥20 Vite 打包的 Vue3 组件库,图标无法显示
  • ¥15 php 同步电商平台多个店铺增量订单和订单状态