manual/en/features.cookies.php
ARCHIVED 2003-06-18, DATE APPROXIMATE · VERSION 20030618_rev01 · COMPARED WITH 20021201_rev01
Full text changes — 20021201_rev01 to 20030618_rev01
COLOUR MARKS THE SEVERITY OF A FLAGGED CLAUSE · + AND − MARK ADDED AND REMOVED
| 1 | 1 | ## Chapter 17. Cookies |
| 2 | 2 | |
| 3 | PHP transparently supports HTTP cookies. Cookies are a mechanism for storing data in the remote browser and thus tracking or identifying return users. You can set cookies using the [**setcookie()**](https://php.net/manual/en/function.setcookie.php) function. Cookies are part of the HTTP header, so [**setcookie()**](https://php.net/manual/en/function.setcookie.php) must be called before any output is sent to the browser. This is the same limitation that [**header()**](https://php.net/manual/en/function.header.php) has. You can use the [output buffering functions](https://php.net/manual/en/ref.outcontrol.php) to delay the script output until you have decided whether or not to set any cookies or send any headers. | |
| 3 | PHP transparently supports HTTP cookies. Cookies are a mechanism for storing data in the remote browser and thus tracking or identifying return users. You can set cookies using the [**setcookie()**](http://www.php.net/manual/en/function.setcookie.php) function. Cookies are part of the HTTP header, so [**setcookie()**](http://www.php.net/manual/en/function.setcookie.php) must be called before any output is sent to the browser. This is the same limitation that [**header()**](http://www.php.net/manual/en/function.header.php) has. You can use the [output buffering functions](http://www.php.net/manual/en/ref.outcontrol.php) to delay the script output until you have decided whether or not to set any cookies or send any headers. | |
| 4 | 4 | |
| 5 | 5 | Any cookies sent to you from the client will automatically be turned into a PHP variable just like GET and POST method data, depending on the register\_globals and variables\_order configuration variables. If you wish to assign multiple values to a single cookie, just add _\[\]_ to the cookie name. |
| 6 | 6 | |
| 7 | 7 | In PHP 4.1.0 and later, the $\_COOKIE auto-global array will always be set with any cookies sent from the client. $HTTP\_COOKIE\_VARS is also set in earlier versions of PHP when the track\_vars configuration variable is set. |
| 8 | 8 | |
| 9 | For more details, including notes on browser bugs, see the [**setcookie()**](https://php.net/manual/en/function.setcookie.php) function. | |
| 9 | For more details, including notes on browser bugs, see the [**setcookie()**](http://www.php.net/manual/en/function.setcookie.php) function. | |
| 10 | 10 | |
| 11 | <table><tbody><tr><td><small>User Contributed Notes</small><br><b>Cookies</b></td><td><a href="https://php.net/manual/add-note.php?sect=features.cookies&redirect=http://www.php.net/manual/en/features.cookies.php"><img src="https://php.net/gifs/notes-add.gif" width="13" height="13" alt="add a note"></a> <a href="https://php.net/manual/about-notes.php"><img src="https://php.net/gifs/notes-about.gif" width="13" height="13" alt="about notes"></a></td></tr><tr><td colspan="2"><a name="#11858"></a><table><tbody><tr><td><b>yasuo_ohgaki at hotmail dot com</b><br>09-Mar-2001 09:58</td><td><br></td></tr><tr><td colspan="2"><code>It might be good idea that manual mentions related standard (RFC2965,RFC2109 for cookie, Netscape's cookie spec also) and URL for the standard.<p>Following link is for cookie definitions:<br><a href="http://portal.research.bell-labs.com/~dmk/cookie.html">http://portal.research.bell-labs.com/~dmk/cookie.html</a></p><p>It seems many users do not read standard definitions, unfortunately. Manual may need to be written to encourage users to read related standards.</p></code><br></td></tr></tbody></table></td></tr><tr><td colspan="2"><a name="#19014"></a></td></tr><tr><td colspan="2"><a href="https://php.net/manual/add-note.php?sect=features.cookies&redirect=http://www.php.net/manual/en/features.cookies.php"><img src="https://php.net/gifs/notes-add.gif" width="13" height="13" alt="add a note"></a> <a href="https://php.net/manual/about-notes.php"><img src="https://php.net/gifs/notes-about.gif" width="13" height="13" alt="about notes"></a></td></tr></tbody></table> | |
| 11 | <table><tbody><tr><td><small>User Contributed Notes</small><br><b>Cookies</b></td><td><a href="http://www.php.net/manual/add-note.php?sect=features.cookies&redirect=http://www.php.net/manual/en/features.cookies.php"><img src="http://static.php.net/www.php.net/images/notes-add.gif" alt="add a note" width="13" height="13"></a> <small><a href="http://www.php.net/manual/add-note.php?sect=features.cookies&redirect=http://www.php.net/manual/en/features.cookies.php">add a note</a></small></td></tr><tr><td colspan="2">There are no user contributed notes for this page.</td></tr></tbody></table> |