note 62369 deleted from function.setcookie by bjori
| From: | bjori@php.net | Date: | Mon, 08 Jan 2007 10:49:30 +0000 |
| Subject: | note 62369 deleted from function.setcookie by bjori | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-121433@lists.php.net to get a copy of this message | ||
Note Submitter: simon at go4 dot com dot au
----
For some reason setting a cookie path without a domain does not appear to work, eg.
<?php
setcookie('cookieName', 'cookieValue', time()+3600, '/');
?>
The path remains the default; 'The default value is the current directory that the cookie is
being set in'. So you cannot access the cookie from outside that sub-directory.
However if you set the cookie with a blank domain, eg.
<?php
setcookie('cookieName', 'cookieValue', time()+3600, '/', false);
?>
Then the path override will work and you can access it from any path in the domain using the code in
the above example ('/').
NOTE: setting the domain to false will cause it to be filled with the default value.