PHP 手册
上一页 |  | 下一页

# http_parse_cookie

(no version information, might be only in CVS)

http_parse_cookie -- Parse HTTP cookie

## 说明

object http_parse_cookie ( string cookie [, int flags [, array allowed_extras]] )

Parses HTTP cookies like sent in a response into a struct.

## 参数

`cookie`

  string containing the value of a `Set-Cookie` response header

`flags`

  parse flags (`HTTP_COOKIE_PARSE_RAW`)

`allowed_extras`

  array containing recognized extra keys; by default all unknown keys will be treated as cookie names

## 返回值

Returns a stdClass object on success or `FALSE` on failure.

## 范例

例 1. Using http_parse_cookie()

`<?php print_r(http_parse_cookie("foo=bar; bar=baz; path=/; domain=example.com; comment=; secure", 0, array("comment"))); ?>`

上例将输出：

    stdClass Object
    (
      [cookies] => Array
      (
        [foo] => bar
        [bar] => baz
      )

      [extras] => Array
      (
        [comment] =>
      )

      [flags] => 16
      [expires] => 0
      [path] => /
      [domain] => example.com
    )

## 参见

http_parse_headers()
http_parse_message()
http_build_cookie()

上一页 | 起始页 | 下一页
ob_inflatehandler | 上一级 | http_parse_headers