PHP Dokumentation: Function http-parse-cookie
12. Januar 2010 von werner
http_parse_cookie
(PECL pecl_http >= 0.20.0)
http_parse_cookie — Parse HTTP cookie
Beschreibung
object http_parse_cookie ( string $cookie [, int $flags [, array $allowed_extras ]] )
Parses HTTP cookies like sent in a response into a struct.
Parameter-Liste
- 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
Rückgabewerte
Returns a stdClass object on successIm Fehlerfall wird FALSE zurückgegeben..
Beispiele
Beispiel #1 Using http_parse_cookie()
<?php
print_r(http_parse_cookie("foo=bar; bar=baz; path=/; domain=example.com; comment=; secure", 0, array("comment")));
?>Das oben gezeigte Beispiel erzeugt folgendeAusgabe:
stdClass Object( [cookies] => Array ( [foo] => bar [bar] => baz ) [extras] => Array ( [comment] => ) [flags] => 16 [expires] => 0 [path] => / [domain] => example.com)
Siehe auch
- http_parse_headers() – Parse HTTP headers
- http_parse_message() – Parse HTTP messages
- http_build_cookie() – Build cookie string
Geschrieben in PHP-Dokumentation | 0 Kommentare