V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
Wallace007
V2EX  ›  Flask

请问如何添加多个 cookie 值呢

  •  
  •   Wallace007 · May 7, 2019 · 6114 views
    This topic created in 2547 days ago, the information mentioned may be changed or developed.

    例如一个 python flask 程序的返回: .... return "hello word", 200, {"Set-Cookie":"name=Wallace"}

    第一、我想再添加一个 age=18 的 cookie 值,该怎么做呢(多个 cookie ) 第二、如何在名为 name 的 cookie 里添加多个关键字的值呢,比如:name={uuu “:28,” ttt “:34}这种的(一个 cookie 里多个值)

    2 replies    2019-05-08 08:42:46 +08:00
    0ZXYDDu796nVCFxq
        1
    0ZXYDDu796nVCFxq  
       May 7, 2019   ❤️ 1
    1.
    resp = make_response('hello word')
    resp.set_cookie('name', 'Wallace')
    resp.set_cookie('age', '18')
    return resp

    2.
    用 subcookies
    https://www.kancloud.cn/kancloud/http-cookies-explained/48321
    Wallace007
        2
    Wallace007  
    OP
       May 8, 2019
    感谢
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   4209 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 40ms · UTC 04:15 · PVG 12:15 · LAX 21:15 · JFK 00:15
    ♥ Do have faith in what you're doing.