⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 filters.convert.html

📁 php的帮助文档,涉及到PHP的案例和基本语法,以及实际应用内容
💻 HTML
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"><html> <head>  <title>Conversion Filters</title>  <meta http-equiv="content-type" content="text/html; charset=UTF-8"> </head> <body><div style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="filters.html">List of Available Filters</a></div> <div class="next" style="text-align: right; float: right;"><a href="filters.compression.html">Compression Filters</a></div> <div class="up"><a href="filters.html">List of Available Filters</a></div> <div class="home"><a href="index.html">PHP Manual</a></div></div><hr /><div id="filters.convert" class="section">  <h2 class="title">Conversion Filters</h2>  <p class="simpara">   Like the string.* filters, the convert.* filters perform actions   similar to their names.  The convert filters were added with   PHP 5.0.0.   For more information on a given filter, refer to the manual page for   the corresponding function.  </p>  <p class="simpara">   <i>convert.base64-encode</i> and   <i>convert.base64-decode</i>   Use of these filters are equivalent to processing all stream data through   the <a href="function.base64-encode.html" class="function">base64_encode()</a> and <a href="function.base64-decode.html" class="function">base64_decode()</a>   functions respectively.   <i>convert.base64-encode</i> supports parameters given as   an associative array.  If <i><tt class="parameter">line-length</tt></i> is given, the   base64 output will be split into chunks of <i><tt class="parameter">line-length</tt></i>   characters each.  If <i><tt class="parameter">line-break-chars</tt></i> is given, each   chunk will be delimited by the characters given.  These parameters give the   same effect as using <a href="function.base64-encode.html" class="function">base64_encode()</a> with   <a href="function.chunk-split.html" class="function">chunk_split()</a>.  </p>  <div class="example">   <p><b>Example #1     convert.base64-encode &amp;    convert.base64-decode   </b></p>   <div class="example-contents"><div class="phpcode"><code><span style="color: #000000"><span style="color: #0000BB">&lt;?php<br />$fp&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">fopen</span><span style="color: #007700">(</span><span style="color: #DD0000">'php://output'</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">'w'</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">stream_filter_append</span><span style="color: #007700">(</span><span style="color: #0000BB">$fp</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">'convert.base64-encode'</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">fwrite</span><span style="color: #007700">(</span><span style="color: #0000BB">$fp</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">"This&nbsp;is&nbsp;a&nbsp;test.\n"</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">fclose</span><span style="color: #007700">(</span><span style="color: #0000BB">$fp</span><span style="color: #007700">);<br /></span><span style="color: #FF8000">/*&nbsp;Outputs:&nbsp;&nbsp;VGhpcyBpcyBhIHRlc3QuCg==&nbsp;&nbsp;*/<br /><br /></span><span style="color: #0000BB">$param&nbsp;</span><span style="color: #007700">=&nbsp;array(</span><span style="color: #DD0000">'line-length'&nbsp;</span><span style="color: #007700">=&gt;&nbsp;</span><span style="color: #0000BB">8</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">'line-break-chars'&nbsp;</span><span style="color: #007700">=&gt;&nbsp;</span><span style="color: #DD0000">"\r\n"</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">$fp&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">fopen</span><span style="color: #007700">(</span><span style="color: #DD0000">'php://output'</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">'w'</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">stream_filter_append</span><span style="color: #007700">(</span><span style="color: #0000BB">$fp</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">'convert.base64-encode'</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">STREAM_FILTER_WRITE</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">$param</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">fwrite</span><span style="color: #007700">(</span><span style="color: #0000BB">$fp</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">"This&nbsp;is&nbsp;a&nbsp;test.\n"</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">fclose</span><span style="color: #007700">(</span><span style="color: #0000BB">$fp</span><span style="color: #007700">);<br /></span><span style="color: #FF8000">/*&nbsp;Outputs:&nbsp;&nbsp;VGhpcyBp<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:&nbsp;&nbsp;cyBhIHRl<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:&nbsp;&nbsp;c3QuCg==&nbsp;&nbsp;*/<br /><br /></span><span style="color: #0000BB">$fp&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">fopen</span><span style="color: #007700">(</span><span style="color: #DD0000">'php://output'</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">'w'</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">stream_filter_append</span><span style="color: #007700">(</span><span style="color: #0000BB">$fp</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">'convert.base64-decode'</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">fwrite</span><span style="color: #007700">(</span><span style="color: #0000BB">$fp</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">"VGhpcyBpcyBhIHRlc3QuCg=="</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">fclose</span><span style="color: #007700">(</span><span style="color: #0000BB">$fp</span><span style="color: #007700">);<br /></span><span style="color: #FF8000">/*&nbsp;Outputs:&nbsp;&nbsp;This&nbsp;is&nbsp;a&nbsp;test.&nbsp;&nbsp;*/<br /></span><span style="color: #0000BB">?&gt;</span></span></code></div>   </div>  </div>  <p class="simpara">   <i>convert.quoted-printable-encode</i> and   <i>convert.quoted-printable-decode</i>   Use of the decode version of this filter is equivalent to processing all stream    data through the <a href="function.quoted-printable-decode.html" class="function">quoted_printable_decode()</a> functions.   There is no function equivalent to <i>convert.quoted-printable-encode</i>.   <i>convert.quoted-printable-encode</i> supports parameters given as   an associative array.  In addition to the parameters supported by    <i>convert.base64-encode</i>, <i>convert.quoted-printable-encode</i>   also supports boolean arguments <i><tt class="parameter">binary</tt></i> and   <i><tt class="parameter">force-encode-first</tt></i>.   <i>convert.base64-decode</i> only supports the   <i><tt class="parameter">line-break-chars</tt></i> parameter as a type-hint   for striping from the encoded payload.  </p>  <div class="example">   <p><b>Example #2     convert.quoted-printable-encode &amp;    convert.quoted-printable-decode   </b></p>   <div class="example-contents"><div class="phpcode"><code><span style="color: #000000"><span style="color: #0000BB">&lt;?php<br />$fp&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">fopen</span><span style="color: #007700">(</span><span style="color: #DD0000">'php://output'</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">'w'</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">stream_filter_append</span><span style="color: #007700">(</span><span style="color: #0000BB">$fp</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">'convert.quoted-printable-encode'</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">fwrite</span><span style="color: #007700">(</span><span style="color: #0000BB">$fp</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">"This&nbsp;is&nbsp;a&nbsp;test.\n"</span><span style="color: #007700">);<br /></span><span style="color: #FF8000">/*&nbsp;Outputs:&nbsp;&nbsp;=This&nbsp;is&nbsp;a&nbsp;test.=0A&nbsp;&nbsp;*/<br /></span><span style="color: #0000BB">?&gt;</span></span></code></div>   </div>  </div> </div><hr /><div style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="filters.html">List of Available Filters</a></div> <div class="next" style="text-align: right; float: right;"><a href="filters.compression.html">Compression Filters</a></div> <div class="up"><a href="filters.html">List of Available Filters</a></div> <div class="home"><a href="index.html">PHP Manual</a></div></div></body></html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -