Sophie

Sophie

distrib > Mandriva > 2008.1 > x86_64 > by-pkgid > 05cd670d8a02b2b4a0ffb1756f2e8308 > files > 6988

php-manual-zh-5.2.4-1mdv2008.1.noarch.rpm

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<HTML
><HEAD
><TITLE
>iconv_mime_decode_headers</TITLE
><META
NAME="GENERATOR"
CONTENT="Modular DocBook HTML Stylesheet Version 1.79"><LINK
REL="HOME"
TITLE="PHP 手册"
HREF="index.html"><LINK
REL="UP"
TITLE="iconv Functions"
HREF="ref.iconv.html"><LINK
REL="PREVIOUS"
TITLE="iconv_get_encoding"
HREF="function.iconv-get-encoding.html"><LINK
REL="NEXT"
TITLE="iconv_mime_decode"
HREF="function.iconv-mime-decode.html"><META
HTTP-EQUIV="Content-type"
CONTENT="text/html; charset=UTF-8"></HEAD
><BODY
CLASS="refentry"
BGCOLOR="#FFFFFF"
TEXT="#000000"
LINK="#0000FF"
VLINK="#840084"
ALINK="#0000FF"
><DIV
CLASS="NAVHEADER"
><TABLE
SUMMARY="Header navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TH
COLSPAN="3"
ALIGN="center"
>PHP 手册</TH
></TR
><TR
><TD
WIDTH="10%"
ALIGN="left"
VALIGN="bottom"
><A
HREF="function.iconv-get-encoding.html"
ACCESSKEY="P"
>上一页</A
></TD
><TD
WIDTH="80%"
ALIGN="center"
VALIGN="bottom"
></TD
><TD
WIDTH="10%"
ALIGN="right"
VALIGN="bottom"
><A
HREF="function.iconv-mime-decode.html"
ACCESSKEY="N"
>下一页</A
></TD
></TR
></TABLE
><HR
ALIGN="LEFT"
WIDTH="100%"></DIV
><H1
><A
NAME="function.iconv-mime-decode-headers"
></A
>iconv_mime_decode_headers</H1
><DIV
CLASS="refnamediv"
><A
NAME="AEN84420"
></A
><P
>    (PHP 5)</P
>iconv_mime_decode_headers&nbsp;--&nbsp;Decodes multiple <TT
CLASS="literal"
>MIME</TT
> header fields at once</DIV
><DIV
CLASS="refsect1"
><A
NAME="AEN84424"
></A
><H2
>说明</H2
>array <B
CLASS="methodname"
>iconv_mime_decode_headers</B
> ( string encoded_headers [, int mode [, string charset]] )<BR
></BR
><P
>&#13;   Returns an associative array that holds a whole set of
   <TT
CLASS="literal"
>MIME</TT
> header fields specified by
   <CODE
CLASS="parameter"
>encoded_headers</CODE
> on success, or <TT
CLASS="constant"
><B
>FALSE</B
></TT
>
   if an error occurs during the decoding.
  </P
><P
>&#13;   Each key of the return value represents an individual
   field name and the corresponding element represents a field value.
   If more than one field of the same name are present,
   <B
CLASS="function"
>iconv_mime_decode_headers()</B
> automatically incorporates
   them into a numerically indexed array in the order of occurrence.
  </P
></DIV
><DIV
CLASS="refsect1"
><A
NAME="AEN84444"
></A
><H2
>参数</H2
><P
>&#13;   <P
></P
><DIV
CLASS="variablelist"
><DL
><DT
><CODE
CLASS="parameter"
>encoded_headers</CODE
></DT
><DD
><P
>&#13;       The encoded headers, as a string.
      </P
></DD
><DT
><CODE
CLASS="parameter"
>mode</CODE
></DT
><DD
><P
>&#13;       <CODE
CLASS="parameter"
>mode</CODE
> determines the behaviour in the event
       <B
CLASS="function"
>iconv_mime_decode_headers()</B
> encounters a malformed
       <TT
CLASS="literal"
>MIME</TT
> header field. You can specify any combination
       of the following bitmasks.
       <DIV
CLASS="table"
><A
NAME="AEN84461"
></A
><P
><B
>表 1. Bitmasks acceptable to <B
CLASS="function"
>iconv_mime_decode_headers()</B
></B
></P
><TABLE
BORDER="1"
CLASS="CALSTABLE"
><COL><COL><COL><THEAD
><TR
><TH
>Value</TH
><TH
>Constant</TH
><TH
>Description</TH
></TR
></THEAD
><TBODY
><TR
><TD
>1</TD
><TD
>ICONV_MIME_DECODE_STRICT</TD
><TD
>&#13;            If set, the given header is decoded in full conformance with the
            standards defined in <A
HREF="http://www.faqs.org/rfcs/rfc2047"
TARGET="_top"
>RFC2047</A
>.
            This option is disabled by default because there are a lot of
            broken mail user agents that don't follow the specification and don't
            produce correct <TT
CLASS="literal"
>MIME</TT
> headers.
           </TD
></TR
><TR
><TD
>2</TD
><TD
>ICONV_MIME_DECODE_CONTINUE_ON_ERROR</TD
><TD
>&#13;            If set, <B
CLASS="function"
>iconv_mime_decode_headers()</B
>
            attempts to ignore any grammatical errors and continue to process
            a given header.
           </TD
></TR
></TBODY
></TABLE
></DIV
>
      </P
></DD
><DT
><CODE
CLASS="parameter"
>charset</CODE
></DT
><DD
><P
>&#13;       The optional <CODE
CLASS="parameter"
>charset</CODE
> parameter specifies the
       character set to represent the result by. If omitted,
       <A
HREF="ref.iconv.html#iconv.configuration"
>iconv.internal_encoding</A
>
       will be used.
      </P
></DD
></DL
></DIV
>
  </P
></DIV
><DIV
CLASS="refsect1"
><A
NAME="AEN84489"
></A
><H2
>范例</H2
><P
>&#13;   <TABLE
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
CLASS="EXAMPLE"
><TR
><TD
><DIV
CLASS="example"
><A
NAME="AEN84492"
></A
><P
><B
>例 1. <B
CLASS="function"
>iconv_mime_decode_headers()</B
> example</B
></P
><TABLE
BORDER="0"
BGCOLOR="#E0E0E0"
CELLPADDING="5"
><TR
><TD
><code><font color="#000000">
<font color="#0000BB">&lt;?php<br />$headers_string </font><font color="#007700">= &lt;&lt;&lt;EOF<br /></font><font color="#0000BB">Subject: =?UTF-8?B?UHLDvGZ1bmcgUHLDvGZ1bmc=?=<br />To: example@example.com<br />Date: Thu, 1 Jan 1970 00:00:00 +0000<br />Message-Id: &lt;example@example.com&gt;<br />Received: from localhost (localhost </font><font color="#007700">[</font><font color="#0000BB">127.0.0.1</font><font color="#007700">]</font><font color="#0000BB">) by localhost<br />&nbsp;&nbsp;&nbsp;&nbsp;with SMTP id example for &lt;example@example.com&gt;;<br />&nbsp;&nbsp;&nbsp;&nbsp;Thu, 1 Jan 1970 00:00:00 +0000 (UTC)<br />&nbsp;&nbsp;&nbsp;&nbsp;(envelope-from example-return-0000-example=example.com@example.com)<br />Received: (qmail 0 invoked by uid 65534); 1 Thu 2003 00:00:00 +0000<br /><br /></font><font color="#007700">EOF;<br /><br /></font><font color="#0000BB">$headers </font><font color="#007700">=&nbsp;&nbsp;</font><font color="#0000BB">iconv_mime_decode_headers</font><font color="#007700">(</font><font color="#0000BB">$headers_string</font><font color="#007700">, </font><font color="#0000BB">0</font><font color="#007700">, </font><font color="#DD0000">"ISO-8859-1"</font><font color="#007700">);<br /></font><font color="#0000BB">print_r</font><font color="#007700">(</font><font color="#0000BB">$headers</font><font color="#007700">);<br /></font><font color="#0000BB">?&gt;</font>
</font>
</code></TD
></TR
></TABLE
><P
>上例将输出:</P
><TABLE
BORDER="0"
BGCOLOR="#E0E0E0"
CELLPADDING="5"
><TR
><TD
><PRE
CLASS="screen"
>Array
(
    [Subject] =&#62; Prüfung Prüfung
    [To] =&#62; example@example.com
    [Date] =&#62; Thu, 1 Jan 1970 00:00:00 +0000
    [Message-Id] =&#62; &#60;example@example.com&#62;
    [Received] =&#62; Array
        (
            [0] =&#62; from localhost (localhost [127.0.0.1]) by localhost with SMTP id example for &#60;example@example.com&#62;; Thu, 1 Jan 1970 00:00:00 +0000 (UTC) (envelope-from example-return-0000-example=example.com@example.com)
            [1] =&#62; (qmail 0 invoked by uid 65534); 1 Thu 2003 00:00:00 +0000
        )

)</PRE
></TD
></TR
></TABLE
></DIV
></TD
></TR
></TABLE
>
  </P
></DIV
><DIV
CLASS="refsect1"
><A
NAME="AEN84498"
></A
><H2
>参见</H2
><P
>&#13;   <P
></P
><TABLE
BORDER="0"
><TBODY
><TR
><TD
><A
HREF="function.iconv-mime-decode.html"
><B
CLASS="function"
>iconv_mime_decode()</B
></A
></TD
></TR
><TR
><TD
><A
HREF="function.mb-decode-mimeheader.html"
><B
CLASS="function"
>mb_decode_mimeheader()</B
></A
></TD
></TR
><TR
><TD
><A
HREF="function.imap-mime-header-decode.html"
><B
CLASS="function"
>imap_mime_header_decode()</B
></A
></TD
></TR
><TR
><TD
><A
HREF="function.imap-base64.html"
><B
CLASS="function"
>imap_base64()</B
></A
></TD
></TR
><TR
><TD
><A
HREF="function.imap-qprint.html"
><B
CLASS="function"
>imap_qprint()</B
></A
></TD
></TR
></TBODY
></TABLE
><P
></P
>
  </P
></DIV
><DIV
CLASS="NAVFOOTER"
><HR
ALIGN="LEFT"
WIDTH="100%"><TABLE
SUMMARY="Footer navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
><A
HREF="function.iconv-get-encoding.html"
ACCESSKEY="P"
>上一页</A
></TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="index.html"
ACCESSKEY="H"
>起始页</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
><A
HREF="function.iconv-mime-decode.html"
ACCESSKEY="N"
>下一页</A
></TD
></TR
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
>iconv_get_encoding</TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="ref.iconv.html"
ACCESSKEY="U"
>上一级</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
>iconv_mime_decode</TD
></TR
></TABLE
></DIV
></BODY
></HTML
>