小编Sab*_*ani的帖子

Golang Cookie Max-Age 与 Expire

Cookie 结构中的 Expires 和 Max-Age 有什么区别?我无法理解。

type Cookie struct {
    Name  string
    Value string

    Path       string    // optional
    Domain     string    // optional
    Expires    time.Time // optional
    RawExpires string    // for reading cookies only

    // MaxAge=0 means no 'Max-Age' attribute specified.
    // MaxAge<0 means delete cookie now, equivalently 'Max-Age: 0'
    // MaxAge>0 means Max-Age attribute present and given in seconds
    MaxAge   int
    Secure   bool
    HttpOnly bool
    SameSite SameSite
    Raw      string
    Unparsed []string // Raw text of unparsed attribute-value pairs
}
Run Code Online (Sandbox Code Playgroud)

cookies http go expires-header max-age

8
推荐指数
1
解决办法
9586
查看次数

标签 统计

cookies ×1

expires-header ×1

go ×1

http ×1

max-age ×1