doujiaohuo1096 2018-08-05 07:27
浏览 130
已采纳

从map [string] string获取单个键值

I have a map being stored in my cookie as followed:

cookieData:=   map[expiration:1533455712 ip:[ hash:dd363d13234566727743277e96 email:user@user.com]

fmt.Println(reflect.TypeOf(cookie)) >> map[string]string

Can someone please help me understand how i can get only the email value from this map?

Thanks in advance.

  • 写回答

1条回答 默认 最新

  • doudun1029 2018-08-05 12:52
    关注

    type casting in golang is done by appending .(T)

    ip := cookieData["ip"].(map[string]string)
    email := ip["email"]
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥30 vmware exsi重置后的密码
  • ¥15 易盾点选的cb参数怎么解啊
  • ¥15 MATLAB运行显示错误,如何解决?
  • ¥15 c++头文件不能识别CDialog
  • ¥15 Excel发现不可读取的内容
  • ¥15 关于#stm32#的问题:CANOpen的PDO同步传输问题
  • ¥20 yolov5自定义Prune报错,如何解决?
  • ¥15 电磁场的matlab仿真
  • ¥15 mars2d在vue3中的引入问题
  • ¥50 h5唤醒支付宝并跳转至向小荷包转账界面