mirror of
https://github.com/fofolee/uTools-Manuals.git
synced 2025-06-18 22:06:57 +08:00
137 lines
6.6 KiB
HTML
137 lines
6.6 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>Get all values from a result entry</title>
|
|
</head>
|
|
<body class="docs"><div id="layout">
|
|
<div id="layout-content"><div id="function.ldap-get-values" class="refentry">
|
|
<div class="refnamediv">
|
|
<h1 class="refname">ldap_get_values</h1>
|
|
<p class="verinfo">(PHP 4, PHP 5, PHP 7)</p><p class="refpurpose"><span class="refname">ldap_get_values</span> — <span class="dc-title">Get all values from a result entry</span></p>
|
|
|
|
</div>
|
|
|
|
<div class="refsect1 description" id="refsect1-function.ldap-get-values-description">
|
|
<h3 class="title">说明</h3>
|
|
<div class="methodsynopsis dc-description">
|
|
<span class="methodname"><strong>ldap_get_values</strong></span>
|
|
( <span class="methodparam"><span class="type">resource</span> <code class="parameter">$link_identifier</code></span>
|
|
, <span class="methodparam"><span class="type">resource</span> <code class="parameter">$result_entry_identifier</code></span>
|
|
, <span class="methodparam"><span class="type">string</span> <code class="parameter">$attribute</code></span>
|
|
) : <span class="type">array</span></div>
|
|
|
|
<p class="para rdfs-comment">
|
|
Reads all the values of the attribute in the entry in the result.
|
|
</p>
|
|
<p class="para">
|
|
This call needs a <code class="parameter">result_entry_identifier</code>,
|
|
so needs to be preceded by one of the ldap search calls and one
|
|
of the calls to get an individual entry.
|
|
</p>
|
|
<p class="para">
|
|
You application will either be hard coded to look for certain
|
|
attributes (such as "surname" or "mail") or you will have to use
|
|
the <span class="function"><a href="ldap_get_attributes.html" class="function">ldap_get_attributes()</a></span> call to work out
|
|
what attributes exist for a given entry.
|
|
</p>
|
|
</div>
|
|
|
|
|
|
<div class="refsect1 parameters" id="refsect1-function.ldap-get-values-parameters">
|
|
<h3 class="title">参数</h3>
|
|
<p class="para">
|
|
<dl>
|
|
|
|
|
|
<dt>
|
|
<code class="parameter">link_identifier</code></dt>
|
|
|
|
<dd>
|
|
|
|
<p class="para">
|
|
An LDAP link identifier, returned by <span class="function"><a href="ldap_connect.html" class="function">ldap_connect()</a></span>.
|
|
</p>
|
|
</dd>
|
|
|
|
|
|
|
|
<dt>
|
|
<code class="parameter">result_entry_identifier</code></dt>
|
|
|
|
<dd>
|
|
|
|
<p class="para">
|
|
</p>
|
|
</dd>
|
|
|
|
|
|
|
|
<dt>
|
|
<code class="parameter">attribute</code></dt>
|
|
|
|
<dd>
|
|
|
|
<p class="para">
|
|
</p>
|
|
</dd>
|
|
|
|
|
|
</dl>
|
|
|
|
</p>
|
|
</div>
|
|
|
|
|
|
<div class="refsect1 returnvalues" id="refsect1-function.ldap-get-values-returnvalues">
|
|
<h3 class="title">返回值</h3>
|
|
<p class="para">
|
|
Returns an array of values for the attribute on success and <strong><code>FALSE</code></strong> on
|
|
error. The number of values can be found by indexing "count" in the
|
|
resultant array. Individual values are accessed by integer index in the
|
|
array. The first index is 0.
|
|
</p>
|
|
<p class="para">
|
|
LDAP allows more than one entry for an attribute, so it can, for example,
|
|
store a number of email addresses for one person's directory entry all
|
|
labeled with the attribute "mail"
|
|
<div class="informalexample">
|
|
<pre class="literallayout">
|
|
return_value["count"] = number of values for attribute
|
|
return_value[0] = first value of attribute
|
|
return_value[i] = ith value of attribute
|
|
</pre>
|
|
</div>
|
|
</p>
|
|
</div>
|
|
|
|
|
|
<div class="refsect1 examples" id="refsect1-function.ldap-get-values-examples">
|
|
<h3 class="title">范例</h3>
|
|
<p class="para">
|
|
<div class="example" id="example-5401">
|
|
<p><strong>Example #1 List all values of the "mail" attribute for a
|
|
directory entry </strong></p>
|
|
<div class="example-contents">
|
|
<div class="phpcode"><pre><span style="color: #000000">
|
|
<span style="color: #0000BB"><?php<br /></span><span style="color: #FF8000">// $ds is a valid link identifier for a directory server<br /><br />// $sr is a valid search result from a prior call to<br />// one of the ldap directory search calls<br /><br />// $entry is a valid entry identifier from a prior call to<br />// one of the calls that returns a directory entry<br /><br /></span><span style="color: #0000BB">$values </span><span style="color: #007700">= </span><span style="color: #0000BB">ldap_get_values</span><span style="color: #007700">(</span><span style="color: #0000BB">$ds</span><span style="color: #007700">, </span><span style="color: #0000BB">$entry</span><span style="color: #007700">, </span><span style="color: #DD0000">"mail"</span><span style="color: #007700">);<br /><br />echo </span><span style="color: #0000BB">$values</span><span style="color: #007700">[</span><span style="color: #DD0000">"count"</span><span style="color: #007700">] . </span><span style="color: #DD0000">" email addresses for this entry.<br />"</span><span style="color: #007700">;<br /><br />for (</span><span style="color: #0000BB">$i</span><span style="color: #007700">=</span><span style="color: #0000BB">0</span><span style="color: #007700">; </span><span style="color: #0000BB">$i </span><span style="color: #007700">< </span><span style="color: #0000BB">$values</span><span style="color: #007700">[</span><span style="color: #DD0000">"count"</span><span style="color: #007700">]; </span><span style="color: #0000BB">$i</span><span style="color: #007700">++) {<br /> echo </span><span style="color: #0000BB">$values</span><span style="color: #007700">[</span><span style="color: #0000BB">$i</span><span style="color: #007700">] . </span><span style="color: #DD0000">"<br />"</span><span style="color: #007700">;<br />}<br /></span><span style="color: #0000BB">?></span>
|
|
</span>
|
|
</pre></div>
|
|
</div>
|
|
|
|
</div>
|
|
</p>
|
|
</div>
|
|
|
|
|
|
<div class="refsect1 seealso" id="refsect1-function.ldap-get-values-seealso">
|
|
<h3 class="title">参见</h3>
|
|
<p class="para">
|
|
<ul class="simplelist">
|
|
<li class="member"><span class="function"><a href="ldap_get_values_len.html" class="function" rel="rdfs-seeAlso">ldap_get_values_len()</a> - Get all binary values from a result entry</span></li>
|
|
</ul>
|
|
</p>
|
|
</div>
|
|
|
|
|
|
</div></div></div></body></html> |