note 62369 added to function.setcookie
| From: | simon at go4 dot com dot au | Date: | Sun, 26 Feb 2006 23:26:20 +0000 |
| Subject: | note 62369 added to function.setcookie | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-104466@lists.php.net to get a copy of this message | ||
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.
----
Server IP: 203.202.10.60
Probable Submitter: 218.214.130.75
----
X-Spam-Status: No, hits=3.1 required=5.0 tests=DATE_MISSING,FROM_NO_LOWER
autolearn=no version=2.64
----
Manual Page -- http://www.php.net/manual/en/function.setcookie.php
Edit -- http://master.php.net/note/edit/62369
Del: integrated -- http://master.php.net/note/delete/62369/integrated
Del: useless -- http://master.php.net/note/delete/62369/useless
Del: bad code -- http://master.php.net/note/delete/62369/bad+code
Del: spam -- http://master.php.net/note/delete/62369/spam
Del: non-english -- http://master.php.net/note/delete/62369/non-english
Del: in docs -- http://master.php.net/note/delete/62369/in+docs
Del: other reasons-- http://master.php.net/note/delete/62369
Reject -- http://master.php.net/note/reject/62369
Search -- http://master.php.net/manage/user-notes.php