This commit is contained in:
fofolee
2019-04-28 19:00:34 +08:00
parent a895309fba
commit f782158fb7
4705 changed files with 471929 additions and 471947 deletions

View File

@@ -1,120 +1,120 @@
<!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-file" class="refentry">
<div class="refnamediv">
<h1 class="refname">hash_file</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_file</span> &mdash; <span class="dc-title">使用给定文件的内容生成哈希值</span></p>
</div>
<div class="refsect1 description" id="refsect1-function.hash-file-description">
<h3 class="title">说明</h3>
<div class="methodsynopsis dc-description">
<span class="methodname"><strong>hash_file</strong></span>
( <span class="methodparam"><span class="type">string</span> <code class="parameter">$algo</code></span>
, <span class="methodparam"><span class="type">string</span> <code class="parameter">$filename</code></span>
[, <span class="methodparam"><span class="type">bool</span> <code class="parameter">$raw_output</code><span class="initializer"> = <strong><code>FALSE</code></strong></span></span>
] ) : <span class="type">string</span></div>
</div>
<div class="refsect1 parameters" id="refsect1-function.hash-file-parameters">
<h3 class="title">参数</h3>
<p class="para">
<dl>
<dt>
<code class="parameter">algo</code></dt>
<dd>
<p class="para">
要使用的哈希算法的名称,例如:&quot;md5&quot;&quot;sha256&quot;&quot;haval160,4&quot; 等。
</p>
</dd>
<dt>
<code class="parameter">filename</code></dt>
<dd>
<p class="para">
要进行哈希运算的文件路径。支持 fopen 封装器。
</p>
</dd>
<dt>
<code class="parameter">raw_output</code></dt>
<dd>
<p class="para">
设置为 <strong><code>TRUE</code></strong>,输出格式为原始的二进制数据。
设置为 <strong><code>FALSE</code></strong>,输出小写的 16 进制字符串。
</p>
</dd>
</dl>
</p>
</div>
<div class="refsect1 returnvalues" id="refsect1-function.hash-file-returnvalues">
<h3 class="title">返回值</h3>
<p class="para">
如果 <code class="parameter">raw_output</code> 设置为 <strong><code>TRUE</code></strong> 则返回原始二进制数据表示的信息摘要,
否则返回 16 进制小写字符串格式表示的信息摘要。
</p>
</div>
<div class="refsect1 examples" id="refsect1-function.hash-file-examples">
<h3 class="title">范例</h3>
<p class="para">
<div class="example" id="example-891">
<p><strong>Example #1 使用 <span class="function"><strong>hash_file()</strong></span></strong></p>
<div class="example-contents">
<div class="phpcode"><pre><span style="color: #000000">
<span style="color: #0000BB">&lt;?php<br /></span><span style="color: #FF8000">/*&nbsp;创建一个要计算哈希值的文件&nbsp;*/<br /></span><span style="color: #0000BB">file_put_contents</span><span style="color: #007700">(</span><span style="color: #DD0000">'example.txt'</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 /><br />echo&nbsp;</span><span style="color: #0000BB">hash_file</span><span style="color: #007700">(</span><span style="color: #DD0000">'md5'</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">'example.txt'</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-file-seealso">
<h3 class="title">参见</h3>
<p class="para">
<ul class="simplelist">
<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_hmac_file.html" class="function" rel="rdfs-seeAlso">hash_hmac_file()</a> - 使用 HMAC 方法和给定文件的内容生成带密钥的哈希值</span></li>
<li class="member"><span class="function"><a href="hash_update_file.html" class="function" rel="rdfs-seeAlso">hash_update_file()</a> - 从文件向活跃的哈希运算上下文中填充数据</span></li>
<li class="member"><span class="function"><a href="md5_file.html" class="function" rel="rdfs-seeAlso">md5_file()</a> - 计算指定文件的 MD5 散列值</span></li>
<li class="member"><span class="function"><a href="sha1_file.html" class="function" rel="rdfs-seeAlso">sha1_file()</a> - 计算文件的 sha1 散列值</span></li>
</ul>
</p>
</div>
<!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-file" class="refentry">
<div class="refnamediv">
<h1 class="refname">hash_file</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_file</span> &mdash; <span class="dc-title">使用给定文件的内容生成哈希值</span></p>
</div>
<div class="refsect1 description" id="refsect1-function.hash-file-description">
<h3 class="title">说明</h3>
<div class="methodsynopsis dc-description">
<span class="methodname"><strong>hash_file</strong></span>
( <span class="methodparam"><span class="type">string</span> <code class="parameter">$algo</code></span>
, <span class="methodparam"><span class="type">string</span> <code class="parameter">$filename</code></span>
[, <span class="methodparam"><span class="type">bool</span> <code class="parameter">$raw_output</code><span class="initializer"> = <strong><code>FALSE</code></strong></span></span>
] ) : <span class="type">string</span></div>
</div>
<div class="refsect1 parameters" id="refsect1-function.hash-file-parameters">
<h3 class="title">参数</h3>
<p class="para">
<dl>
<dt>
<code class="parameter">algo</code></dt>
<dd>
<p class="para">
要使用的哈希算法的名称,例如:&quot;md5&quot;&quot;sha256&quot;&quot;haval160,4&quot; 等。
</p>
</dd>
<dt>
<code class="parameter">filename</code></dt>
<dd>
<p class="para">
要进行哈希运算的文件路径。支持 fopen 封装器。
</p>
</dd>
<dt>
<code class="parameter">raw_output</code></dt>
<dd>
<p class="para">
设置为 <strong><code>TRUE</code></strong>,输出格式为原始的二进制数据。
设置为 <strong><code>FALSE</code></strong>,输出小写的 16 进制字符串。
</p>
</dd>
</dl>
</p>
</div>
<div class="refsect1 returnvalues" id="refsect1-function.hash-file-returnvalues">
<h3 class="title">返回值</h3>
<p class="para">
如果 <code class="parameter">raw_output</code> 设置为 <strong><code>TRUE</code></strong> 则返回原始二进制数据表示的信息摘要,
否则返回 16 进制小写字符串格式表示的信息摘要。
</p>
</div>
<div class="refsect1 examples" id="refsect1-function.hash-file-examples">
<h3 class="title">范例</h3>
<p class="para">
<div class="example" id="example-891">
<p><strong>Example #1 使用 <span class="function"><strong>hash_file()</strong></span></strong></p>
<div class="example-contents">
<div class="phpcode"><pre><span style="color: #000000">
<span style="color: #0000BB">&lt;?php<br /></span><span style="color: #FF8000">/*&nbsp;创建一个要计算哈希值的文件&nbsp;*/<br /></span><span style="color: #0000BB">file_put_contents</span><span style="color: #007700">(</span><span style="color: #DD0000">'example.txt'</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 /><br />echo&nbsp;</span><span style="color: #0000BB">hash_file</span><span style="color: #007700">(</span><span style="color: #DD0000">'md5'</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">'example.txt'</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-file-seealso">
<h3 class="title">参见</h3>
<p class="para">
<ul class="simplelist">
<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_hmac_file.html" class="function" rel="rdfs-seeAlso">hash_hmac_file()</a> - 使用 HMAC 方法和给定文件的内容生成带密钥的哈希值</span></li>
<li class="member"><span class="function"><a href="hash_update_file.html" class="function" rel="rdfs-seeAlso">hash_update_file()</a> - 从文件向活跃的哈希运算上下文中填充数据</span></li>
<li class="member"><span class="function"><a href="md5_file.html" class="function" rel="rdfs-seeAlso">md5_file()</a> - 计算指定文件的 MD5 散列值</span></li>
<li class="member"><span class="function"><a href="sha1_file.html" class="function" rel="rdfs-seeAlso">sha1_file()</a> - 计算文件的 sha1 散列值</span></li>
</ul>
</p>
</div>
</div></div></div></body></html>