mirror of
https://github.com/fofolee/uTools-Manuals.git
synced 2025-06-17 21:16:57 +08:00
100 lines
3.9 KiB
HTML
100 lines
3.9 KiB
HTML
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
|
<html>
|
|
<head>
|
|
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
|
|
<title>使用 MIME base64 对数据进行编码</title>
|
|
</head>
|
|
<body class="docs"><div id="layout">
|
|
<div id="layout-content"><div id="function.base64-encode" class="refentry">
|
|
<div class="refnamediv">
|
|
<h1 class="refname">base64_encode</h1>
|
|
<p class="verinfo">(PHP 4, PHP 5, PHP 7)</p><p class="refpurpose"><span class="refname">base64_encode</span> — <span class="dc-title">使用 MIME base64 对数据进行编码</span></p>
|
|
|
|
</div>
|
|
<div class="refsect1 description" id="refsect1-function.base64-encode-description">
|
|
<h3 class="title">说明</h3>
|
|
<div class="methodsynopsis dc-description">
|
|
<span class="methodname"><strong>base64_encode</strong></span>
|
|
( <span class="methodparam"><span class="type">string</span> <code class="parameter">$data</code></span>
|
|
) : <span class="type">string</span></div>
|
|
|
|
<p class="para rdfs-comment">
|
|
使用 base64 对 <code class="parameter">data</code> 进行编码。
|
|
</p>
|
|
<p class="para">
|
|
设计此种编码是为了使二进制数据可以通过非纯
|
|
8-bit 的传输层传输,例如电子邮件的主体。
|
|
</p>
|
|
<p class="para">
|
|
Base64-encoded 数据要比原始数据多占用 33% 左右的空间。
|
|
</p>
|
|
</div>
|
|
|
|
|
|
<div class="refsect1 parameters" id="refsect1-function.base64-encode-parameters">
|
|
<h3 class="title">参数</h3>
|
|
<p class="para">
|
|
<dl>
|
|
|
|
|
|
<dt>
|
|
<code class="parameter">data</code></dt>
|
|
|
|
<dd>
|
|
|
|
<p class="para">
|
|
要编码的数据。
|
|
</p>
|
|
</dd>
|
|
|
|
|
|
</dl>
|
|
|
|
</p>
|
|
</div>
|
|
|
|
|
|
<div class="refsect1 returnvalues" id="refsect1-function.base64-encode-returnvalues">
|
|
<h3 class="title">返回值</h3>
|
|
<p class="para">
|
|
编码后的字符串数据, 或者在失败时返回 <strong><code>FALSE</code></strong>。
|
|
</p>
|
|
</div>
|
|
|
|
|
|
<div class="refsect1 examples" id="refsect1-function.base64-encode-examples">
|
|
<h3 class="title">范例</h3>
|
|
<p class="para">
|
|
<div class="example" id="example-4882">
|
|
<p><strong>Example #1 <span class="function"><strong>base64_encode()</strong></span> 示例</strong></p>
|
|
<div class="example-contents">
|
|
<div class="phpcode"><pre><span style="color: #000000">
|
|
<span style="color: #0000BB"><?php<br />$str </span><span style="color: #007700">= </span><span style="color: #DD0000">'This is an encoded string'</span><span style="color: #007700">;<br />echo </span><span style="color: #0000BB">base64_encode</span><span style="color: #007700">(</span><span style="color: #0000BB">$str</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">?></span>
|
|
</span>
|
|
</pre></div>
|
|
</div>
|
|
|
|
<div class="example-contents"><p>以上例程会输出:</p></div>
|
|
<div class="example-contents screen">
|
|
<div class="cdata"><pre>
|
|
VGhpcyBpcyBhbiBlbmNvZGVkIHN0cmluZw==
|
|
</pre></div>
|
|
</div>
|
|
</div>
|
|
</p>
|
|
</div>
|
|
|
|
|
|
<div class="refsect1 seealso" id="refsect1-function.base64-encode-seealso">
|
|
<h3 class="title">参见</h3>
|
|
<p class="para">
|
|
<ul class="simplelist">
|
|
<li class="member"><span class="function"><a href="base64_decode.html" class="function" rel="rdfs-seeAlso">base64_decode()</a> - 对使用 MIME base64 编码的数据进行解码</span></li>
|
|
<li class="member"><span class="function"><a href="chunk_split.html" class="function" rel="rdfs-seeAlso">chunk_split()</a> - 将字符串分割成小块</span></li>
|
|
<li class="member"><span class="function"><a href="convert_uuencode.html" class="function" rel="rdfs-seeAlso">convert_uuencode()</a> - 使用 uuencode 编码一个字符串</span></li>
|
|
<li class="member"><a href="http://www.faqs.org/rfcs/rfc2045" class="link external">» RFC 2045</a> 6.8 章节</li>
|
|
</ul>
|
|
</p>
|
|
</div>
|
|
|
|
</div></div></div></body></html> |