uTools-Manuals/docs/php/hash_update_stream.html
2019-04-08 23:22:26 +08:00

148 lines
6.1 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>从打开的流向活跃的哈希运算上下文中填充数据</title>
</head>
<body class="docs"><div id="layout">
<div id="layout-content"><div id="function.hash-update-stream" class="refentry">
<div class="refnamediv">
<h1 class="refname">hash_update_stream</h1>
<p class="verinfo">(PHP 5 &gt;= 5.1.2, PHP 7, PECL hash &gt;= 1.1)</p><p class="refpurpose"><span class="refname">hash_update_stream</span> &mdash; <span class="dc-title">从打开的流向活跃的哈希运算上下文中填充数据</span></p>
</div>
<div class="refsect1 description" id="refsect1-function.hash-update-stream-description">
<h3 class="title">说明</h3>
<div class="methodsynopsis dc-description">
<span class="methodname"><strong>hash_update_stream</strong></span>
( <span class="methodparam"><span class="type"><span class="type HashContext">HashContext</span></span> <code class="parameter">$context</code></span>
, <span class="methodparam"><span class="type">resource</span> <code class="parameter">$handle</code></span>
[, <span class="methodparam"><span class="type">int</span> <code class="parameter">$length</code><span class="initializer"> = -1</span></span>
] ) : <span class="type">int</span></div>
</div>
<div class="refsect1 parameters" id="refsect1-function.hash-update-stream-parameters">
<h3 class="title">参数</h3>
<p class="para">
<dl>
<dt>
<code class="parameter">context</code></dt>
<dd>
<p class="para">
<span class="function"><a href="hash_init.html" class="function">hash_init()</a></span> 函数返回的哈希运算上下文。
</p>
</dd>
<dt>
<code class="parameter">handle</code></dt>
<dd>
<p class="para">
创建流的函数返回的打开的文件句柄。
</p>
</dd>
<dt>
<code class="parameter">length</code></dt>
<dd>
<p class="para">
要从 <code class="parameter">handle</code> 向活跃的哈希运算上下文中拷贝
的最大字符数。
</p>
</dd>
</dl>
</p>
</div>
<div class="refsect1 returnvalues" id="refsect1-function.hash-update-stream-returnvalues">
<h3 class="title">返回值</h3>
<p class="para">
<code class="parameter">handle</code> 向哈希运算上下文中实际填充的字节数量。
</p>
</div>
<div class="refsect1 changelog" id="refsect1-function.hash-update-stream-changelog">
<h3 class="title">更新日志</h3>
<p class="para">
<table class="doctable informaltable">
<thead>
<tr>
<th>版本</th>
<th>说明</th>
</tr>
</thead>
<tbody class="tbody">
<tr>
<td>7.2.0</td>
<td>
接收参数从资源类型修改为 <strong class="classname">HashContext</strong> 对象类型。
</td>
</tr>
</tbody>
</table>
</p>
</div>
<div class="refsect1 examples" id="refsect1-function.hash-update-stream-examples">
<h3 class="title">范例</h3>
<p class="para">
<div class="example" id="random-bytes.example.basic">
<p><strong>Example #1 <span class="function"><strong>hash_update_stream()</strong></span> 例程</strong></p>
<div class="example-contents">
<div class="phpcode"><pre><span style="color: #000000">
<span style="color: #0000BB">&lt;?php<br />$fp&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">tmpfile</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">'The&nbsp;quick&nbsp;brown&nbsp;fox&nbsp;jumped&nbsp;over&nbsp;the&nbsp;lazy&nbsp;dog.'</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">rewind</span><span style="color: #007700">(</span><span style="color: #0000BB">$fp</span><span style="color: #007700">);<br /><br /></span><span style="color: #0000BB">$ctx&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">hash_init</span><span style="color: #007700">(</span><span style="color: #DD0000">'md5'</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">hash_update_stream</span><span style="color: #007700">(</span><span style="color: #0000BB">$ctx</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">$fp</span><span style="color: #007700">);<br />echo&nbsp;</span><span style="color: #0000BB">hash_final</span><span style="color: #007700">(</span><span style="color: #0000BB">$ctx</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">?&gt;</span>
</span>
</pre></div>
</div>
<div class="example-contents"><p>以上例程会输出:</p></div>
<div class="example-contents screen">
<div class="cdata"><pre>
5c6ffbdd40d9556b73a21e63c3e0e904
</pre></div>
</div>
</div>
</p>
</div>
<div class="refsect1 seealso" id="refsect1-function.hash-update-stream-seealso">
<h3 class="title">参见</h3>
<p class="para">
<ul class="simplelist">
<li class="member"><span class="function"><a href="hash_init.html" class="function" rel="rdfs-seeAlso">hash_init()</a> - 初始化增量哈希运算上下文</span></li>
<li class="member"><span class="function"><a href="hash_update.html" class="function" rel="rdfs-seeAlso">hash_update()</a> - 向活跃的哈希运算上下文中填充数据</span></li>
<li class="member"><span class="function"><a href="hash_final.html" class="function" rel="rdfs-seeAlso">hash_final()</a> - 结束增量哈希,并且返回摘要结果</span></li>
<li class="member"><span class="function"><a href="hash.html" class="function" rel="rdfs-seeAlso">hash()</a> - 生成哈希值 (消息摘要)</span></li>
<li class="member"><span class="function"><a href="hash_file.html" class="function" rel="rdfs-seeAlso">hash_file()</a> - 使用给定文件的内容生成哈希值</span></li>
</ul>
</p>
</div>
</div></div></div></body></html>