PHP supports HTTPcookie transparently. Cookie is a mechanism for storing data in a remote browser and tracking and identifying users. You can use the setcookie () or setrawcookie () function to set the cookie. PHP supports HTTP cookies transparently. Cookie is a mechanism for storing data in a remote browser and tracking and identifying users. You can use the setcookie () or setrawcookie () function to set the cookie. Cookie is a part of the HTTP header. Therefore, the setcookie () function must be called before other information is output to the browser. This is similar to the limitation on the header () function. You can use the output buffer function to delay the script output until all cookies or other HTTP headers are set as needed.
Example #1 setcookie () Example
If variables_order contains "C", any cookie sent from the client will be automatically included in the $ _ COOKIE automatic global array. If you want to set multiple values for a cookie variable, you must add the [] symbol after the cookie name.
$value) { $name = htmlspecialchars($name); $value = htmlspecialchars($value); echo "$name : $value
\n"; } } ?>
According to register_globals settings, you can create common PHP variables from cookies. However, this feature is not recommended because this option is usually disabled for security reasons. In earlier PHP versions, when the track_vars configuration option is enabled (this option is always enabled since PHP 4.0.3), the system also sets $ HTTP_COOKIE_VARS.
The above is the session mechanism 1, which is characteristic of PHP. For more information about Cookie usage, see PHP Chinese website (www.php1.cn )!