manual/en/features.cookies.php
20070204_rev01 · COMPARED WITH 20061201_rev01 · ARCHIVE SNAPSHOT, DATE APPROXIMATE
Full text changes — 20061201_rev01 to 20070204_rev01
| 1 | 1 | ## Chapter 35. 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()**](http://www.php.net/manual/en/function.setcookie.php) or [**setrawcookie()**](http://www.php.net/manual/en/function.setrawcookie.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. | |
| 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) or [setrawcookie()](http://www.php.net/manual/en/function.setrawcookie.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 included into a [$\_COOKIE](http://www.php.net/manual/en/reserved.variables.php) auto-global array if [variables\_order](http://www.php.net/manual/en/ini.core.php) contains "C". If you wish to assign multiple values to a single cookie, just add \[\] to the cookie name. |
| 6 | 6 | |
| 7 | 7 | Depending on [register\_globals](http://www.php.net/manual/en/ini.core.php), regular PHP variables can be created from cookies. However it's not recommended to rely on them as this feature is often turned off for the sake of security. $HTTP\_COOKIE\_VARS is also set in earlier versions of PHP when the [track\_vars](http://www.php.net/manual/en/ini.core.php) configuration variable is set. (This setting is always on since PHP 4.0.3.) |
| 8 | 8 | |
| 9 | For more details, including notes on browser bugs, see the [**setcookie()**](http://www.php.net/manual/en/function.setcookie.php) and [**setrawcookie()**](http://www.php.net/manual/en/function.setrawcookie.php) function. | |
| 9 | For more details, including notes on browser bugs, see the [setcookie()](http://www.php.net/manual/en/function.setcookie.php) and [setrawcookie()](http://www.php.net/manual/en/function.setrawcookie.php) function. | |
| 10 | 10 | |
| 11 | 11 | [add a note](http://www.php.net/manual/add-note.php) User Contributed Notes |
| 12 | 12 | **Cookies** |
| 13 | 13 | |
| 14 | 14 | **ingen at stocken.ws** |
| 15 | 15 | [19-Nov-2006 12:26](http://www.php.net/manual/en/features.cookies.php) |