Sophie

Sophie

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

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_encode</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_mime_decode"
HREF="function.iconv-mime-decode.html"><LINK
REL="NEXT"
TITLE="iconv_set_encoding"
HREF="function.iconv-set-encoding.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-mime-decode.html"
ACCESSKEY="P"
>上一页</A
></TD
><TD
WIDTH="80%"
ALIGN="center"
VALIGN="bottom"
></TD
><TD
WIDTH="10%"
ALIGN="right"
VALIGN="bottom"
><A
HREF="function.iconv-set-encoding.html"
ACCESSKEY="N"
>下一页</A
></TD
></TR
></TABLE
><HR
ALIGN="LEFT"
WIDTH="100%"></DIV
><H1
><A
NAME="function.iconv-mime-encode"
></A
>iconv_mime_encode</H1
><DIV
CLASS="refnamediv"
><A
NAME="AEN84605"
></A
><P
>    (PHP 5)</P
>iconv_mime_encode&nbsp;--&nbsp;Composes a <TT
CLASS="literal"
>MIME</TT
> header field</DIV
><DIV
CLASS="refsect1"
><A
NAME="AEN84609"
></A
><H2
>说明</H2
>string <B
CLASS="methodname"
>iconv_mime_encode</B
> ( string field_name, string field_value [, array preferences] )<BR
></BR
><P
>&#13;   Composes and returns a string that represents a valid <TT
CLASS="literal"
>MIME</TT
>
   header field, which looks like the following:
   <TABLE
BORDER="0"
BGCOLOR="#E0E0E0"
CELLPADDING="5"
><TR
><TD
><PRE
CLASS="screen"
>Subject: =?ISO-8859-1?Q?Pr=FCfung_f=FCr?= Entwerfen von einer MIME kopfzeile</PRE
></TD
></TR
></TABLE
>
   In the above example, "Subject" is the field name and the portion that
   begins with "=?ISO-8859-1?..." is the field value.
  </P
></DIV
><DIV
CLASS="refsect1"
><A
NAME="AEN84626"
></A
><H2
>参数</H2
><P
>&#13;   <P
></P
><DIV
CLASS="variablelist"
><DL
><DT
><CODE
CLASS="parameter"
>field_name</CODE
></DT
><DD
><P
>&#13;       The field name.
      </P
></DD
><DT
><CODE
CLASS="parameter"
>field_value</CODE
></DT
><DD
><P
>&#13;       The field value.
      </P
></DD
><DT
><CODE
CLASS="parameter"
>preferences</CODE
></DT
><DD
><P
>&#13;       You can control the behaviour of <B
CLASS="function"
>iconv_mime_encode()</B
>
       by specifying an associative array that contains configuration items
       to the optional third parameter <CODE
CLASS="parameter"
>preferences</CODE
>.
       The items supported by <B
CLASS="function"
>iconv_mime_encode()</B
> are
       listed below. Note that item names are treated case-sensitive.
       <DIV
CLASS="table"
><A
NAME="AEN84648"
></A
><P
><B
>表 1. Configuration items supported by <B
CLASS="function"
>iconv_mime_encode()</B
></B
></P
><TABLE
BORDER="1"
CLASS="CALSTABLE"
><COL><COL><COL><COL><COL><THEAD
><TR
><TH
>Item</TH
><TH
>Type</TH
><TH
>Description</TH
><TH
>Default value</TH
><TH
>Example</TH
></TR
></THEAD
><TBODY
><TR
><TD
>scheme</TD
><TD
><A
HREF="language.types.boolean.html"
><B
CLASS="type"
>boolean</B
></A
></TD
><TD
>&#13;            Specifies the method to encode a field value by. The value of
            this item may be either "B" or "Q", where "B" stands for
            <TT
CLASS="literal"
>base64</TT
> encoding scheme and "Q" stands for
            <TT
CLASS="literal"
>quoted-printable</TT
> encoding scheme.
           </TD
><TD
>B</TD
><TD
>B</TD
></TR
><TR
><TD
>input-charset</TD
><TD
><A
HREF="language.types.string.html"
><B
CLASS="type"
>string</B
></A
></TD
><TD
>&#13;            Specifies the character set in which the first parameter
            <CODE
CLASS="parameter"
>field_name</CODE
> and the second parameter
            <CODE
CLASS="parameter"
>field_value</CODE
> are presented. If not given,
            <B
CLASS="function"
>iconv_mime_encode()</B
> assumes those parameters
            are presented to it in the
            <A
HREF="ref.iconv.html#iconv.configuration"
>iconv.internal_encoding</A
>
            ini setting.
           </TD
><TD
>&#13;            <A
HREF="ref.iconv.html#iconv.configuration"
>iconv.internal_encoding</A
>
           </TD
><TD
>ISO-8859-1</TD
></TR
><TR
><TD
>output-charset</TD
><TD
><A
HREF="language.types.string.html"
><B
CLASS="type"
>string</B
></A
></TD
><TD
>&#13;            Specifies the character set to use to compose the
            <TT
CLASS="literal"
>MIME</TT
> header. If not given, the same value as
            <TT
CLASS="literal"
>input-charset</TT
> will be used.
           </TD
><TD
>&#13;            <A
HREF="ref.iconv.html#iconv.configuration"
>iconv.internal_encoding</A
>
           </TD
><TD
>UTF-8</TD
></TR
><TR
><TD
>line-length</TD
><TD
><A
HREF="language.types.integer.html"
><B
CLASS="type"
>integer</B
></A
></TD
><TD
>&#13;            Specifies the maximum length of the header lines. The resulting
            header is "folded" to a set of multiple lines in case
            the resulting header field would be longer than the value of this
            parameter, according to
            <A
HREF="http://www.faqs.org/rfcs/rfc2822"
TARGET="_top"
>RFC2822 - Internet Message Format</A
>.
            If not given, the length will be limited to 76 characters.
           </TD
><TD
>76</TD
><TD
>996</TD
></TR
><TR
><TD
>line-break-chars</TD
><TD
><A
HREF="language.types.string.html"
><B
CLASS="type"
>string</B
></A
></TD
><TD
>&#13;            Specifies the sequence of characters to append to each line
            as an end-of-line sign when "folding" is performed on a long header
            field. If not given, this defaults to "\r\n"
            (<TT
CLASS="literal"
>CR</TT
> <TT
CLASS="literal"
>LF</TT
>). Note that
            this parameter is always treated as an ASCII string regardless
            of the value of <TT
CLASS="literal"
>input-charset</TT
>.
           </TD
><TD
>\r\n</TD
><TD
>\n</TD
></TR
></TBODY
></TABLE
></DIV
>
      </P
></DD
></DL
></DIV
>
  </P
></DIV
><DIV
CLASS="refsect1"
><A
NAME="AEN84709"
></A
><H2
>返回值</H2
><P
>&#13;   Returns an encoded <TT
CLASS="literal"
>MIME</TT
> field on success,
   or <TT
CLASS="constant"
><B
>FALSE</B
></TT
> if an error occurs during the encoding.
  </P
></DIV
><DIV
CLASS="refsect1"
><A
NAME="AEN84714"
></A
><H2
>范例</H2
><P
>&#13;   <TABLE
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
CLASS="EXAMPLE"
><TR
><TD
><DIV
CLASS="example"
><A
NAME="AEN84717"
></A
><P
><B
>例 1. <B
CLASS="function"
>iconv_mime_encode()</B
> example</B
></P
><TABLE
BORDER="0"
BGCOLOR="#E0E0E0"
CELLPADDING="5"
><TR
><TD
><code><font color="#000000">
<font color="#0000BB">&lt;?php<br />$preferences </font><font color="#007700">= array(<br />&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#DD0000">"input-charset" </font><font color="#007700">=&gt; </font><font color="#DD0000">"ISO-8859-1"</font><font color="#007700">,<br />&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#DD0000">"output-charset" </font><font color="#007700">=&gt; </font><font color="#DD0000">"UTF-8"</font><font color="#007700">,<br />&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#DD0000">"line-length" </font><font color="#007700">=&gt; </font><font color="#0000BB">76</font><font color="#007700">,<br />&nbsp;&nbsp;&nbsp;&nbsp;</font><font color="#DD0000">"line-break-chars" </font><font color="#007700">=&gt; </font><font color="#DD0000">"\n"<br /></font><font color="#007700">);<br /></font><font color="#0000BB">$preferences</font><font color="#007700">[</font><font color="#DD0000">"scheme"</font><font color="#007700">] = </font><font color="#DD0000">"Q"</font><font color="#007700">;<br /></font><font color="#FF8000">// This yields "Subject: =?UTF-8?Q?Pr=C3=BCfung_Pr=C3=BCfung?="<br /></font><font color="#007700">echo </font><font color="#0000BB">iconv_mime_encode</font><font color="#007700">(</font><font color="#DD0000">"Subject"</font><font color="#007700">, </font><font color="#DD0000">"Prüfung Prüfung"</font><font color="#007700">, </font><font color="#0000BB">$preferences</font><font color="#007700">);<br /><br /></font><font color="#0000BB">$preferences</font><font color="#007700">[</font><font color="#DD0000">"scheme"</font><font color="#007700">] = </font><font color="#DD0000">"B"</font><font color="#007700">;<br /></font><font color="#FF8000">// This yields "Subject: =?UTF-8?B?UHLDvGZ1bmcgUHLDvGZ1bmc=?="<br /></font><font color="#007700">echo </font><font color="#0000BB">iconv_mime_encode</font><font color="#007700">(</font><font color="#DD0000">"Subject"</font><font color="#007700">, </font><font color="#DD0000">"Prüfung Prüfung"</font><font color="#007700">, </font><font color="#0000BB">$preferences</font><font color="#007700">);<br /></font><font color="#0000BB">?&gt;</font>
</font>
</code></TD
></TR
></TABLE
></DIV
></TD
></TR
></TABLE
>
  </P
></DIV
><DIV
CLASS="refsect1"
><A
NAME="AEN84721"
></A
><H2
>参见</H2
><P
>&#13;   <P
></P
><TABLE
BORDER="0"
><TBODY
><TR
><TD
><A
HREF="function.imap-binary.html"
><B
CLASS="function"
>imap_binary()</B
></A
></TD
></TR
><TR
><TD
><A
HREF="function.mb-encode-mimeheader.html"
><B
CLASS="function"
>mb_encode_mimeheader()</B
></A
></TD
></TR
><TR
><TD
><A
HREF="function.imap-8bit.html"
><B
CLASS="function"
>imap_8bit()</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-mime-decode.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-set-encoding.html"
ACCESSKEY="N"
>下一页</A
></TD
></TR
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
>iconv_mime_decode</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_set_encoding</TD
></TR
></TABLE
></DIV
></BODY
></HTML
>