iconv_mime_decode_headers

(PHP 5, PHP 7)

iconv_mime_decode_headers一锟斤拷锟皆斤拷锟斤拷锟斤拷 MIME 头锟街讹拷

说锟斤拷

iconv_mime_decode_headers ( string $encoded_headers [, int $mode = 0 [, string $charset = ini_get("iconv.internal_encoding") ]] ) : array

一锟斤拷锟皆斤拷锟斤拷锟斤拷 MIME 头锟街段★拷

锟斤拷锟斤拷

encoded_headers

锟斤拷锟斤拷锟斤拷锟酵凤拷锟斤拷锟揭伙拷锟斤拷址锟斤拷锟斤拷锟�

mode

mode 锟斤拷锟斤拷锟斤拷 iconv_mime_decode_headers() 锟斤拷锟斤拷锟斤拷锟斤拷 MIME 头锟街讹拷时锟斤拷锟斤拷为锟斤拷 锟斤拷锟斤拷锟街革拷锟轿拷锟斤拷锟轿伙拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷稀锟�

iconv_mime_decode_headers() 锟斤拷锟杰碉拷位锟斤拷锟斤拷
锟斤拷锟斤拷 锟斤拷锟斤拷
1 ICONV_MIME_DECODE_STRICT 锟斤拷锟斤拷锟斤拷锟斤拷耍锟斤拷锟斤拷锟斤拷锟酵凤拷锟斤拷锟斤拷锟� » RFC2047 锟斤拷锟斤拷谋锟阶硷拷锟饺伙拷隆锟� 锟斤拷锟窖★拷锟侥拷辖锟斤拷茫锟斤拷锟轿拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟绞硷拷锟矫伙拷锟斤拷锟斤拷锟斤拷循锟斤拷准锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷确锟斤拷 MIME 头锟斤拷
2 ICONV_MIME_DECODE_CONTINUE_ON_ERROR 锟斤拷锟斤拷锟斤拷锟斤拷耍锟�iconv_mime_decode_headers() 锟斤拷锟皆猴拷锟斤拷锟轿猴拷锟斤法锟斤拷锟襟并硷拷锟斤拷锟斤拷锟斤拷指锟斤拷锟斤拷头锟斤拷

charset

锟斤拷选锟斤拷锟斤拷 charset 指锟斤拷锟斤拷锟街凤拷锟斤拷锟斤拷锟斤拷谋锟斤拷帧锟� 锟斤拷锟绞★拷锟斤拷耍锟斤拷锟绞癸拷锟� iconv.internal_encoding锟斤拷

锟斤拷锟斤拷值

锟缴癸拷时锟斤拷锟斤拷 encoded_headers 指锟斤拷锟斤拷 MIME 头锟斤拷锟斤拷锟阶癸拷锟斤拷锟斤拷锟介,锟斤拷锟斤拷时锟斤拷锟街达拷锟斤拷锟津返伙拷 FALSE锟斤拷

锟斤拷锟斤拷元锟截碉拷每锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷侄锟斤拷锟斤拷锟斤拷锟接︼拷锟皆拷卮锟斤拷锟揭伙拷锟斤拷侄锟街碉拷锟� 锟斤拷锟斤拷卸锟斤拷同一锟斤拷锟狡碉拷锟街段o拷 iconv_mime_decode_headers() 锟皆讹拷锟斤拷锟斤拷锟角帮拷锟斤拷锟斤拷顺锟斤拷锟较筹拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟介。

锟斤拷锟斤拷

Example #1 iconv_mime_decode_headers() 锟斤拷锟斤拷

<?php
$headers_string 
= <<<EOF
Subject: =?UTF-8?B?UHLDvGZ1bmcgUHLDvGZ1bmc=?=
To: example@example.com
Date: Thu, 1 Jan 1970 00:00:00 +0000
Message-Id: <example@example.com>
Received: from localhost (localhost [127.0.0.1]) by localhost
    with SMTP id example for <example@example.com>;
    Thu, 1 Jan 1970 00:00:00 +0000 (UTC)
    (envelope-from example-return-0000-example=example.com@example.com)
Received: (qmail 0 invoked by uid 65534); 1 Thu 2003 00:00:00 +0000

EOF;

$headers =  iconv_mime_decode_headers($headers_string0"ISO-8859-1");
print_r($headers);
?>

锟斤拷锟斤拷锟斤拷锟教伙拷锟斤拷锟斤拷锟�

Array
(
    [Subject] => Pr锟斤拷fung Pr锟斤拷fung
    [To] => example@example.com
    [Date] => Thu, 1 Jan 1970 00:00:00 +0000
    [Message-Id] => <example@example.com>
    [Received] => Array
        (
            [0] => from localhost (localhost [127.0.0.1]) by localhost with SMTP id example for <example@example.com>; Thu, 1 Jan 1970 00:00:00 +0000 (UTC) (envelope-from example-return-0000-example=example.com@example.com)
            [1] => (qmail 0 invoked by uid 65534); 1 Thu 2003 00:00:00 +0000
        )

)

锟轿硷拷