note 16142 deleted from function.setcookie by imajes
| From: | imajes@php.net | Date: | Wed, 30 Jan 2002 05:42:27 +0000 |
| Subject: | note 16142 deleted from function.setcookie by imajes | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-26008@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;");
?>