note 72473 deleted from function.session-set-cookie-params by nlopess

From: Date: Sun, 21 Jan 2007 15:42:28 +0000
Subject: note 72473 deleted from function.session-set-cookie-params by nlopess
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-121987@lists.php.net to get a copy of this message
Note Submitter: fusionstream at gmail dot com ---- Regarding trukin@gmail.com's note, it is errant. ============================== trukin at gmail dot com 31-Dec-2006 03:31 There is something that the php manual does not explain very well, the lifetime of the cookie is not the sum of time() + whatever you want. It should be whatever you want: CORRECT: $life = 60 * 60 * 24 * 30; // 30 days WRONG: $life = time() + (60 * 60 * 24 * 30); ============================== Sir, according to the manual here: http://sg.php.net/manual/en/function.setcookie.php, the correct syntax is indeed time()+seconds. The lifetime is determined as the number of seconds passed since the Unix Epoch. Therefore, time()+60*60*24*30 is correct.

« previous php.notes (#121987) next »