CCookie::setMaxAge
The CCookie::setMaxAge function sets the maximum age of the cookie.
int setMaxAge(
int maxAge // specifying the maximum age of the cookie in seconds
);
Return Type
int
Upon successful completion, zero is returned. Otherwise, a value of non-zero is returned.
Parameters
maxAge
An integer specifying the maximum age of the cookie in seconds.
Remarks
This function sets the maximum age of the cookie. The value of the maximum age is the lifetime of the cookie in seconds. It is a decimal non-negative integer. To handle cached cookies correctly, a client SHOULD calculate the age of the cookie according to the age calculation rules in the HTTP/1.1 specification [RFC2616]. When the age is greater than seconds of maximum age, the client SHOULD discard the cookie. A value of zero means the cookie SHOULD be discarded immediately.
The CCookie::getMaxAge function can be used to retrieve the maximum age of the cookie.
See Also
CCookie, CCookie::getMaxAge, CResponse::addCookie, CRequest::getCookies, CRequest::getCookie
Example