PHP 手册
上一页 |  | 下一页

# http_parse_headers

(PECL)

http_parse_headers -- Parse HTTP headers

## 说明

array http_parse_headers ( string header )

Parses HTTP headers into an associative array.

## 参数

`header`

  string containing HTTP headers

## 返回值

Returns an array on success, or `FALSE` on failure.

## 范例

例 1. Using http_parse_headers()

`<?php $headers = "content-type: text/html; charset=UTF-8\r\n". "Server: Funky/1.0\r\n". "Set-Cookie: foo=bar\r\n". "Set-Cookie: baz=quux\r\n". "Folded: works\r\n\ttoo\r\n"; print_r(http_parse_headers($headers)); ?>`

上例将输出：

    Array
    (
      [Content-Type] => text/html; chatset=UTF-8
      [Server] => Funky/1.0
      [Set-Cookie] => Array
      (
        [0] => foo=bar
        [1] => baz=quux
      )
      [Folded] => works
        too
    )

## 参见

http_parse_message()
http_parse_cookie()

上一页 | 起始页 | 下一页
http_parse_cookie | 上一级 | http_parse_message