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

📄 function.sha1.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>Calculate the sha1 hash of a string</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="function.sha1-file.html">sha1_file</a></div> <div class="next" style="text-align: right; float: right;"><a href="function.similar-text.html">similar_text</a></div> <div class="up"><a href="ref.strings.html">String Functions</a></div> <div class="home"><a href="index.html">PHP Manual</a></div></div><hr /><div id="function.sha1" class="refentry"> <div class="refnamediv">  <h1 class="refname">sha1</h1>  <p class="verinfo">(PHP 4 &gt;= 4.3.0, PHP 5, PECL hash:1.1-1.3)</p><p class="refpurpose"><span class="refname">sha1</span> &mdash; <span class="dc-title">Calculate the sha1 hash of a string</span></p> </div>  <div class="refsect1 description">  <h3 class="title">Description</h3>  <div class="methodsynopsis dc-description">   <span class="type">string</span> <span class="methodname"><b><b>sha1</b></b></span>    ( <span class="methodparam"><span class="type">string</span> <tt class="parameter">$str</tt></span>   [, <span class="methodparam"><span class="type">bool</span> <tt class="parameter">$raw_output</tt></span>  ] )</div>  <p class="simpara">   Calculates the sha1 hash of <i><tt class="parameter">str</tt></i> using the   <a href="http://www.faqs.org/rfcs/rfc3174" class="link external">&raquo; US Secure Hash Algorithm 1</a>.  </p> </div> <div class="refsect1 parameters">  <h3 class="title">Parameters</h3>  <p class="para">   <dl>    <dt>     <span class="term"><i><tt class="parameter">str</tt></i></span>     <dd>      <p class="para">       The input string.      </p>     </dd>    </dt>    <dt>     <span class="term"><i><tt class="parameter">raw_output</tt></i></span>     <dd>      <p class="para">       If the optional <i><tt class="parameter">raw_output</tt></i> is set to <b><tt>TRUE</tt></b>,       then the sha1 digest is instead returned in raw binary format with a       length of 20, otherwise the returned value is a 40-character       hexadecimal number. Defaults to <b><tt>FALSE</tt></b>.      </p>     </dd>    </dt>   </dl>  </p> </div> <div class="refsect1 returnvalues">  <h3 class="title">Return Values</h3>  <p class="para">   Returns the sha1 hash as a string.  </p> </div> <div class="refsect1 changelog">  <h3 class="title">ChangeLog</h3>  <p class="para">   <table class="informaltable">    <colgroup>     <thead valign="middle">      <tr valign="middle">       <th colspan="1">Version</th>       <th colspan="1">Description</th>      </tr>     </thead>     <tbody valign="middle" class="tbody">      <tr valign="middle">       <td colspan="1" rowspan="1" align="left">5.0.0</td>       <td colspan="1" rowspan="1" align="left">        The <i><tt class="parameter">raw_output</tt></i> parameter was added.       </td>      </tr>     </tbody>    </colgroup>   </table>  </p> </div> <div class="refsect1 examples">  <h3 class="title">Examples</h3>  <p class="para">   <div class="example">    <p><b>Example #1 A <b>sha1()</b> example</b></p>    <div class="example-contents"><div class="phpcode"><code><span style="color: #000000"><span style="color: #0000BB">&lt;?php<br />$str&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #DD0000">'apple'</span><span style="color: #007700">;<br /><br />if&nbsp;(</span><span style="color: #0000BB">sha1</span><span style="color: #007700">(</span><span style="color: #0000BB">$str</span><span style="color: #007700">)&nbsp;===&nbsp;</span><span style="color: #DD0000">'d0be2dc421be4fcd0172e5afceea3970e2f3d940'</span><span style="color: #007700">)&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;echo&nbsp;</span><span style="color: #DD0000">"Would&nbsp;you&nbsp;like&nbsp;a&nbsp;green&nbsp;or&nbsp;red&nbsp;apple?"</span><span style="color: #007700">;<br />&nbsp;&nbsp;&nbsp;&nbsp;exit;<br />}<br /></span><span style="color: #0000BB">?&gt;</span></span></code></div>    </div>   </div>  </p> </div> <div class="refsect1 seealso">  <h3 class="title">See Also</h3>  <p class="para">   <ul class="simplelist">    <li class="member"><a href="function.sha1-file.html" class="function" rel="rdfs-seeAlso">sha1_file()</a></li>    <li class="member"><a href="function.crc32.html" class="function" rel="rdfs-seeAlso">crc32()</a></li>    <li class="member"><a href="function.md5.html" class="function" rel="rdfs-seeAlso">md5()</a></li>    <li class="member"><a href="function.hash.html" class="function" rel="rdfs-seeAlso">hash()</a></li>   </ul>  </p> </div></div><hr /><div style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="function.sha1-file.html">sha1_file</a></div> <div class="next" style="text-align: right; float: right;"><a href="function.similar-text.html">similar_text</a></div> <div class="up"><a href="ref.strings.html">String Functions</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 + -