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

87 lines
3.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>返回指定对象的hash id</title>
</head>
<body class="docs"><div id="layout">
<div id="layout-content"><div id="function.spl-object-hash" class="refentry">
<div class="refnamediv">
<h1 class="refname">spl_object_hash</h1>
<p class="verinfo">(PHP 5 &gt;= 5.2.0, PHP 7)</p><p class="refpurpose"><span class="refname">spl_object_hash</span> &mdash; <span class="dc-title">
返回指定对象的hash id
</span></p>
</div>
<div class="refsect1 description" id="refsect1-function.spl-object-hash-description">
<h3 class="title">说明</h3>
<div class="methodsynopsis dc-description">
<span class="methodname"><strong>spl_object_hash</strong></span>
( <span class="methodparam"><span class="type">object</span> <code class="parameter">$obj</code></span>
) : <span class="type">string</span></div>
<p class="para rdfs-comment">
本函数为指定对象返回一个唯一标识符。这个标识符可用于作为保存对象或区分不同对象的hash key。
</p>
</div>
<div class="refsect1 parameters" id="refsect1-function.spl-object-hash-parameters">
<h3 class="title">参数</h3>
<p class="para">
<dl>
<dt>
<code class="parameter">object</code></dt>
<dd>
<p class="para">
Any object.
</p>
</dd>
</dl>
</p>
</div>
<div class="refsect1 returnvalues" id="refsect1-function.spl-object-hash-returnvalues">
<h3 class="title">返回值</h3>
<p class="para">
字符串,对于每个对象它都是唯一的,并且对同一个对象它总是相同。
</p>
</div>
<div class="refsect1 examples" id="refsect1-function.spl-object-hash-examples">
<h3 class="title">范例</h3>
<p class="para">
<div class="example" id="regexiterator.setpregflags.example.basic">
<p><strong>Example #1 A <span class="function"><strong>spl_object_hash()</strong></span> example</strong></p>
<div class="example-contents">
<div class="phpcode"><pre><span style="color: #000000">
<span style="color: #0000BB">&lt;?php<br />$id&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">spl_object_hash</span><span style="color: #007700">(</span><span style="color: #0000BB">$object</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">$storage</span><span style="color: #007700">[</span><span style="color: #0000BB">$id</span><span style="color: #007700">]&nbsp;=&nbsp;</span><span style="color: #0000BB">$object</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">?&gt;</span>
</span>
</pre></div>
</div>
</div>
</p>
</div>
<div class="refsect1 notes" id="refsect1-function.spl-object-hash-notes">
<h3 class="title">注释</h3>
<blockquote class="note"><p><strong class="note">Note</strong>:
<p class="para">
When an object is destroyed, its hash may be reused for other objects.
</p>
</p></blockquote>
</div>
</div></div></div></body></html>