user1935281
user1935281

Reputation:

PHP or JavaScript or jQuery cookie expire 5 minutes

How would I use PHP to set a cookie to expire in 5 minutes? I'm familar with setcookie(), but not with it's time property. An explanation would be nice.

Can somebody please point me to the right direction (or include a sample code)?

Thanks a lot. :)

(P.S. I woudn't mind a solution in jQuery or in JavaScript either.)

Upvotes: 2

Views: 5835

Answers (1)

Class
Class

Reputation: 3160

setcookie() set the expire to time() + (60 * 5) 60 = seconds. 5 = how many minutes.

setcookie($name, $value, time() + (60 * 5), $path, $domain)

Upvotes: 3

Related Questions