Skeletor
Skeletor

Reputation: 3403

Is it possible in php session to set expire time for a certain key/value?

We have an expire time for the whole session which erases all the session when time is up. But is there a way to give an expire time to a certain key? For example the session expires in 3 hours so all data will expire in 3 hours. But what if I want that the $_SESSION['five_min_value'] key and its values to expire earlier than others? Is there a built in session way or have I to deal with that on myself?

Upvotes: 0

Views: 95

Answers (2)

ampedo
ampedo

Reputation: 253

try using cookies setcookie(name, value, expire, path, domain, security);

Upvotes: 1

Shane Henry
Shane Henry

Reputation: 318

No not without handling the them manually. However you can set specific expire times for cookies. You could use cookies instead.

Upvotes: 1

Related Questions