function.ldap-list.html

来自「php的帮助文档,涉及到PHP的案例和基本语法,以及实际应用内容」· HTML 代码 · 共 313 行

HTML
313
字号
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"><html> <head>  <title>Single-level search</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.ldap-get-values.html">ldap_get_values</a></div> <div class="next" style="text-align: right; float: right;"><a href="function.ldap-mod-add.html">ldap_mod_add</a></div> <div class="up"><a href="ref.ldap.html">LDAP Functions</a></div> <div class="home"><a href="index.html">PHP Manual</a></div></div><hr /><div id="function.ldap-list" class="refentry"> <div class="refnamediv">  <h1 class="refname">ldap_list</h1>  <p class="verinfo">(PHP 4, PHP 5)</p><p class="refpurpose"><span class="refname">ldap_list</span> &mdash; <span class="dc-title">Single-level search</span></p> </div>  <div class="refsect1 description">  <h3 class="title">Description</h3>  <div class="methodsynopsis dc-description">   <span class="type">resource</span> <span class="methodname"><b><b>ldap_list</b></b></span>    ( <span class="methodparam"><span class="type">resource</span> <tt class="parameter">$link_identifier</tt></span>   , <span class="methodparam"><span class="type">string</span> <tt class="parameter">$base_dn</tt></span>   , <span class="methodparam"><span class="type">string</span> <tt class="parameter">$filter</tt></span>   [, <span class="methodparam"><span class="type">array</span> <tt class="parameter">$attributes</tt></span>   [, <span class="methodparam"><span class="type">int</span> <tt class="parameter">$attrsonly</tt></span>   [, <span class="methodparam"><span class="type">int</span> <tt class="parameter">$sizelimit</tt></span>   [, <span class="methodparam"><span class="type">int</span> <tt class="parameter">$timelimit</tt></span>   [, <span class="methodparam"><span class="type">int</span> <tt class="parameter">$deref</tt></span>  ]]]]] )</div>  <p class="para rdfs-comment">   Performs the search for a specified <i><tt class="parameter">filter</tt></i> on the   directory with the scope <b><tt>LDAP_SCOPE_ONELEVEL</tt></b>.  </p>  <p class="para">   <b><tt>LDAP_SCOPE_ONELEVEL</tt></b> means that the search should only   return information that is at the level immediately below the   <i><tt class="parameter">base_dn</tt></i> given in the call.   (Equivalent to typing &quot;ls&quot; and getting a list of files and folders in the   current working directory.)  </p> </div> <div class="refsect1 parameters">  <h3 class="title">Parameters</h3>  <p class="para">   <dl>    <dt>     <span class="term"><i><tt class="parameter">link_identifier</tt></i></span>     <dd>      <p class="para">       An LDAP link identifier, returned by <a href="function.ldap-connect.html" class="function">ldap_connect()</a>.      </p>     </dd>    </dt>    <dt>     <span class="term"><i><tt class="parameter">base_dn</tt></i></span>     <dd>      <p class="para">       The base DN for the directory.      </p>     </dd>    </dt>    <dt>     <span class="term"><i><tt class="parameter">filter</tt></i></span>     <dd>      <p class="para">      </p>     </dd>    </dt>    <dt>     <span class="term"><i><tt class="parameter">attributes</tt></i></span>     <dd>      <p class="para">       An array of the required attributes, e.g. array(&quot;mail&quot;, &quot;sn&quot;, &quot;cn&quot;).       Note that the &quot;dn&quot; 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>    <dt>     <span class="term"><i><tt class="parameter">attrsonly</tt></i></span>     <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>    <dt>     <span class="term"><i><tt class="parameter">sizelimit</tt></i></span>     <dd>      <p class="para">       Enables you to limit the count of entries fetched. Setting this to 0       means no limit.      </p>      <blockquote><p><b class="note">Note</b>:                This parameter can NOT override server-side preset sizelimit. You can        set it lower though.       <br />               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.       <br />      </p></blockquote>     </dd>    </dt>    <dt>     <span class="term"><i><tt class="parameter">timelimit</tt></i></span>     <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><p><b class="note">Note</b>:                This parameter can NOT override server-side preset timelimit. You can        set it lower though.       <br />      </p></blockquote>     </dd>    </dt>    <dt>     <span class="term"><i><tt class="parameter">deref</tt></i></span>     <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">          <b><tt>LDAP_DEREF_NEVER</tt></b> - (default) aliases are never          dereferenced.         </span>        </li>        <li class="listitem">         <span class="simpara">          <b><tt>LDAP_DEREF_SEARCHING</tt></b> - 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">          <b><tt>LDAP_DEREF_FINDING</tt></b> - aliases should be          dereferenced when locating the base object but not during the search.         </span>        </li>        <li class="listitem">         <span class="simpara">          <b><tt>LDAP_DEREF_ALWAYS</tt></b> - aliases should be dereferenced          always.         </span>        </li>       </ul>      </p>     </dd>    </dt>   </dl>  </p> </div> <div class="refsect1 returnvalues">  <h3 class="title">Return Values</h3>  <p class="para">   Returns a search result identifier or <b><tt>FALSE</tt></b> on error.  </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">4.0.5</td>       <td colspan="1" rowspan="1" align="left">        Parallel searches support was added. See         <a href="function.ldap-search.html" class="function">ldap_search()</a> for details.       </td>      </tr>      <tr valign="middle">       <td colspan="1" rowspan="1" align="left">4.0.2</td>       <td colspan="1" rowspan="1" align="left">        The <i><tt class="parameter">attrsonly</tt></i>, <i><tt class="parameter">sizelimit</tt></i>,        <i><tt class="parameter">timelimit</tt></i> and <i><tt class="parameter">deref</tt></i> were        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 Produce a list of all organizational units of an organization</b></p>    <div class="example-contents"><div class="phpcode"><code><span style="color: #000000">//&nbsp;$ds&nbsp;is&nbsp;a&nbsp;valid&nbsp;link&nbsp;identifier&nbsp;for&nbsp;a&nbsp;directory&nbsp;server<br /><br />$basedn&nbsp;=&nbsp;"o=My&nbsp;Company,&nbsp;c=US";<br />$justthese&nbsp;=&nbsp;array("ou");<br /><br />$sr=ldap_list($ds,&nbsp;$basedn,&nbsp;"ou=*",&nbsp;$justthese);<br /><br />$info&nbsp;=&nbsp;ldap_get_entries($ds,&nbsp;$sr);<br /><br />for&nbsp;($i=0;&nbsp;$i&lt;$info["count"];&nbsp;$i++)&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;echo&nbsp;$info[$i]["ou"][0]&nbsp;;<br />}</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.ldap-search.html" class="function" rel="rdfs-seeAlso">ldap_search()</a></li>   </ul>  </p> </div></div><hr /><div style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="function.ldap-get-values.html">ldap_get_values</a></div> <div class="next" style="text-align: right; float: right;"><a href="function.ldap-mod-add.html">ldap_mod_add</a></div> <div class="up"><a href="ref.ldap.html">LDAP Functions</a></div> <div class="home"><a href="index.html">PHP Manual</a></div></div></body></html>

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?