note 16142 added to function.setcookie

From: Date: Wed, 17 Oct 2001 19:52:13 +0000
Subject: note 16142 added to function.setcookie
Groups: php.notes 
Request: Send a blank email to php-notes+get-19063@lists.php.net to get a copy of this message
IE 5 for Macintosh does not appear to accept cookies using setCookie() when a date is set. Session-expiry cookies seem to work just fine. If you need to set a cookie that will live beyond the current session, the following code works just fine by manually formatting the Set-Cookie header: <?php // set a cookie to expire in 90 days $name = "my_cookie_name"; $value = "my_cookie_value"; $date = date("r",strtotime("+90 day")); $path = "/"; Header("Set-Cookie: $name=$value; expires=$date; path=$path;"); ?> -- http://www.php.net/manual/en/function.setcookie.php http://master.php.net/manage/user-notes.php?action=edit+16142 http://master.php.net/manage/user-notes.php?action=delete+16142 http://master.php.net/manage/user-notes.php?action=reject+16142

« previous php.notes (#19063) next »