<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$TOC_DEPRECATED = array();
$PARENTS = array();
include_once dirname(__FILE__) ."/toc/features.inc";
$setup = array (
  'home' => 
  array (
    0 => 'index.php',
    1 => 'PHP Manual',
  ),
  'head' => 
  array (
    0 => 'UTF-8',
    1 => 'zh',
  ),
  'this' => 
  array (
    0 => 'features.cookies.php',
    1 => 'Cookie',
    2 => 'Cookie',
  ),
  'up' => 
  array (
    0 => 'features.php',
    1 => '特点',
  ),
  'prev' => 
  array (
    0 => 'features.http-auth.php',
    1 => '用 PHP 进行 HTTP 认证',
  ),
  'next' => 
  array (
    0 => 'features.sessions.php',
    1 => '会话',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'zh',
    'path' => 'features/cookies.xml',
  ),
  'history' => 
  array (
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="features.cookies" class="chapter">
 <h1 class="title">Cookie</h1>


 <p class="para">
  PHP 透明地支持 <abbr title="Hypertext Transfer Protocol">HTTP</abbr> cookie。cookie
  是一种在远程浏览器端储存数据并以此来跟踪和识别用户的机制。可以用
  <span class="function"><a href="function.setcookie.php" class="function">setcookie()</a></span> 或
  <span class="function"><a href="function.setrawcookie.php" class="function">setrawcookie()</a></span> 函数来设置 cookie。cookie 是
  <abbr title="Hypertext Transfer Protocol">HTTP</abbr> 标头的一部分，因此
  <span class="function"><a href="function.setcookie.php" class="function">setcookie()</a></span> 函数必须在其它信息被输出到浏览器前调用，这和对
  <span class="function"><a href="function.header.php" class="function">header()</a></span> 函数的限制类似。可以使用<a href="ref.outcontrol.php" class="link">输出缓冲函数</a>来延迟脚本的输出，直到按需要设置好了所有的
  cookie 或者其它HTTP头。
 </p>

 <p class="para">
  如果 <a href="ini.core.php#ini.variables-order" class="link">variables_order</a>
  中包括“C”，则任何从客户端发送的 cookie 都会被自动包括进
  <var class="varname"><a href="reserved.variables.cookies.php" class="classname">$_COOKIE</a></var>
  自动全局数组。如果希望对一个
  cookie 变量设置多个值，则需在 cookie 的名称后加 <code class="literal">[]</code> 符号。
 </p>

 <p class="para">
  关于更多细节以及有关浏览器问题的注意事项，参见 <span class="function"><a href="function.setcookie.php" class="function">setcookie()</a></span>
  和 <span class="function"><a href="function.setrawcookie.php" class="function">setrawcookie()</a></span> 函数。
 </p>

</div>
<?php manual_footer($setup); ?>