mirror of
https://github.com/fofolee/uTools-Manuals.git
synced 2025-06-18 05:26:57 +08:00
292 lines
11 KiB
HTML
292 lines
11 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>Single-level search</title>
|
|
</head>
|
|
<body class="docs"><div id="layout">
|
|
<div id="layout-content"><div id="function.ldap-list" class="refentry">
|
|
<div class="refnamediv">
|
|
<h1 class="refname">ldap_list</h1>
|
|
<p class="verinfo">(PHP 4, PHP 5, PHP 7)</p><p class="refpurpose"><span class="refname">ldap_list</span> — <span class="dc-title">Single-level search</span></p>
|
|
|
|
</div>
|
|
|
|
<div class="refsect1 description" id="refsect1-function.ldap-list-description">
|
|
<h3 class="title">说明</h3>
|
|
<div class="methodsynopsis dc-description">
|
|
<span class="methodname"><strong>ldap_list</strong></span>
|
|
( <span class="methodparam"><span class="type">resource</span> <code class="parameter">$link_identifier</code></span>
|
|
, <span class="methodparam"><span class="type">string</span> <code class="parameter">$base_dn</code></span>
|
|
, <span class="methodparam"><span class="type">string</span> <code class="parameter">$filter</code></span>
|
|
[, <span class="methodparam"><span class="type">array</span> <code class="parameter">$attributes</code><span class="initializer"> = array("*")</span></span>
|
|
[, <span class="methodparam"><span class="type">int</span> <code class="parameter">$attrsonly</code><span class="initializer"> = 0</span></span>
|
|
[, <span class="methodparam"><span class="type">int</span> <code class="parameter">$sizelimit</code><span class="initializer"> = -1</span></span>
|
|
[, <span class="methodparam"><span class="type">int</span> <code class="parameter">$timelimit</code><span class="initializer"> = -1</span></span>
|
|
[, <span class="methodparam"><span class="type">int</span> <code class="parameter">$deref</code><span class="initializer"> = LDAP_DEREF_NEVER</span></span>
|
|
[, <span class="methodparam"><span class="type">array</span> <code class="parameter">$serverctrls</code><span class="initializer"> = array()</span></span>
|
|
]]]]]] ) : <span class="type">resource</span></div>
|
|
|
|
<p class="para rdfs-comment">
|
|
Performs the search for a specified <code class="parameter">filter</code> on the
|
|
directory with the scope <strong><code>LDAP_SCOPE_ONELEVEL</code></strong>.
|
|
</p>
|
|
<p class="para">
|
|
<strong><code>LDAP_SCOPE_ONELEVEL</code></strong> means that the search should only
|
|
return information that is at the level immediately below the
|
|
<code class="parameter">base_dn</code> given in the call.
|
|
(Equivalent to typing "<strong class="command">ls</strong>" and getting a list of files and folders in the
|
|
current working directory.)
|
|
</p>
|
|
</div>
|
|
|
|
|
|
<div class="refsect1 parameters" id="refsect1-function.ldap-list-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">base_dn</code></dt>
|
|
|
|
<dd>
|
|
|
|
<p class="para">
|
|
The base DN for the directory.
|
|
</p>
|
|
</dd>
|
|
|
|
|
|
|
|
<dt>
|
|
<code class="parameter">filter</code></dt>
|
|
|
|
<dd>
|
|
|
|
<p class="para">
|
|
</p>
|
|
</dd>
|
|
|
|
|
|
|
|
<dt>
|
|
<code class="parameter">attributes</code></dt>
|
|
|
|
<dd>
|
|
|
|
<p class="para">
|
|
An array of the required attributes, e.g. array("mail", "sn", "cn").
|
|
Note that the "dn" is always returned irrespective of which attributes
|
|
types are requested.
|
|
</p>
|
|
<p class="para">
|
|
Using this parameter is much more efficient than the default action
|
|
(which is to return all attributes and their associated values).
|
|
The use of this parameter should therefore be considered good
|
|
practice.
|
|
</p>
|
|
</dd>
|
|
|
|
|
|
|
|
<dt>
|
|
<code class="parameter">attrsonly</code></dt>
|
|
|
|
<dd>
|
|
|
|
<p class="para">
|
|
Should be set to 1 if only attribute types are wanted. If set to 0
|
|
both attributes types and attribute values are fetched which is the
|
|
default behaviour.
|
|
</p>
|
|
</dd>
|
|
|
|
|
|
|
|
<dt>
|
|
<code class="parameter">sizelimit</code></dt>
|
|
|
|
<dd>
|
|
|
|
<p class="para">
|
|
Enables you to limit the count of entries fetched. Setting this to 0
|
|
means no limit.
|
|
</p>
|
|
<blockquote class="note"><p><strong class="note">Note</strong>:
|
|
<p class="para">
|
|
This parameter can NOT override server-side preset sizelimit. You can
|
|
set it lower though.
|
|
</p>
|
|
<p class="para">
|
|
Some directory server hosts will be configured to return no more than
|
|
a preset number of entries. If this occurs, the server will indicate
|
|
that it has only returned a partial results set. This also occurs if
|
|
you use this parameter to limit the count of fetched entries.
|
|
</p>
|
|
</p></blockquote>
|
|
</dd>
|
|
|
|
|
|
|
|
<dt>
|
|
<code class="parameter">timelimit</code></dt>
|
|
|
|
<dd>
|
|
|
|
<p class="para">
|
|
Sets the number of seconds how long is spend on the search. Setting
|
|
this to 0 means no limit.
|
|
</p>
|
|
<blockquote class="note"><p><strong class="note">Note</strong>:
|
|
<p class="para">
|
|
This parameter can NOT override server-side preset timelimit. You can
|
|
set it lower though.
|
|
</p>
|
|
</p></blockquote>
|
|
</dd>
|
|
|
|
|
|
|
|
<dt>
|
|
<code class="parameter">deref</code></dt>
|
|
|
|
<dd>
|
|
|
|
<p class="para">
|
|
Specifies how aliases should be handled during the search. It can be
|
|
one of the following:
|
|
<ul class="itemizedlist">
|
|
<li class="listitem">
|
|
<span class="simpara">
|
|
<strong><code>LDAP_DEREF_NEVER</code></strong> - (default) aliases are never
|
|
dereferenced.
|
|
</span>
|
|
</li>
|
|
<li class="listitem">
|
|
<span class="simpara">
|
|
<strong><code>LDAP_DEREF_SEARCHING</code></strong> - aliases should be
|
|
dereferenced during the search but not when locating the base object
|
|
of the search.
|
|
</span>
|
|
</li>
|
|
<li class="listitem">
|
|
<span class="simpara">
|
|
<strong><code>LDAP_DEREF_FINDING</code></strong> - aliases should be
|
|
dereferenced when locating the base object but not during the search.
|
|
</span>
|
|
</li>
|
|
<li class="listitem">
|
|
<span class="simpara">
|
|
<strong><code>LDAP_DEREF_ALWAYS</code></strong> - aliases should be dereferenced
|
|
always.
|
|
</span>
|
|
</li>
|
|
</ul>
|
|
</p>
|
|
</dd>
|
|
|
|
|
|
|
|
<dt>
|
|
<code class="parameter">serverctrls</code></dt>
|
|
|
|
<dd>
|
|
|
|
<p class="para">
|
|
Array of <a href="ldap.controls.html" class="link">LDAP Controls</a> to send with the request.
|
|
</p>
|
|
</dd>
|
|
|
|
|
|
</dl>
|
|
|
|
</p>
|
|
</div>
|
|
|
|
|
|
<div class="refsect1 returnvalues" id="refsect1-function.ldap-list-returnvalues">
|
|
<h3 class="title">返回值</h3>
|
|
<p class="para">
|
|
Returns a search result identifier or <strong><code>FALSE</code></strong> on error.
|
|
</p>
|
|
</div>
|
|
|
|
|
|
<div class="refsect1 changelog" id="refsect1-function.ldap-list-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>4.0.5</td>
|
|
<td>
|
|
Parallel searches support was added. See
|
|
<span class="function"><a href="ldap_search.html" class="function">ldap_search()</a></span> for details.
|
|
</td>
|
|
</tr>
|
|
|
|
<tr>
|
|
<td>7.3</td>
|
|
<td>
|
|
Support for <code class="parameter">serverctrls</code> added
|
|
</td>
|
|
</tr>
|
|
|
|
</tbody>
|
|
|
|
</table>
|
|
|
|
</p>
|
|
</div>
|
|
|
|
|
|
<div class="refsect1 examples" id="refsect1-function.ldap-list-examples">
|
|
<h3 class="title">范例</h3>
|
|
<p class="para">
|
|
<div class="example" id="example-5402">
|
|
<p><strong>Example #1 Produce a list of all organizational units of an organization</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 /></span><span style="color: #0000BB">$basedn </span><span style="color: #007700">= </span><span style="color: #DD0000">"o=My Company, c=US"</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">$justthese </span><span style="color: #007700">= array(</span><span style="color: #DD0000">"ou"</span><span style="color: #007700">);<br /><br /></span><span style="color: #0000BB">$sr </span><span style="color: #007700">= </span><span style="color: #0000BB">ldap_list</span><span style="color: #007700">(</span><span style="color: #0000BB">$ds</span><span style="color: #007700">, </span><span style="color: #0000BB">$basedn</span><span style="color: #007700">, </span><span style="color: #DD0000">"ou=*"</span><span style="color: #007700">, </span><span style="color: #0000BB">$justthese</span><span style="color: #007700">);<br /><br /></span><span style="color: #0000BB">$info </span><span style="color: #007700">= </span><span style="color: #0000BB">ldap_get_entries</span><span style="color: #007700">(</span><span style="color: #0000BB">$ds</span><span style="color: #007700">, </span><span style="color: #0000BB">$sr</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">$info</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">$info</span><span style="color: #007700">[</span><span style="color: #0000BB">$i</span><span style="color: #007700">][</span><span style="color: #DD0000">"ou"</span><span style="color: #007700">][</span><span style="color: #0000BB">0</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-list-seealso">
|
|
<h3 class="title">参见</h3>
|
|
<p class="para">
|
|
<ul class="simplelist">
|
|
<li class="member"><span class="function"><a href="ldap_search.html" class="function" rel="rdfs-seeAlso">ldap_search()</a> - Search LDAP tree</span></li>
|
|
</ul>
|
|
</p>
|
|
</div>
|
|
|
|
|
|
</div></div></div></body></html> |