<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/include/shared-manual.inc';
$TOC = array();
$TOC_DEPRECATED = array();
$PARENTS = array();
include_once dirname(__FILE__) ."/toc/ref.ldap.inc";
$setup = array (
  'home' => 
  array (
    0 => 'index.php',
    1 => 'PHP Manual',
  ),
  'head' => 
  array (
    0 => 'UTF-8',
    1 => 'zh',
  ),
  'this' => 
  array (
    0 => 'function.ldap-get-attributes.php',
    1 => 'ldap_get_attributes',
    2 => 'Get attributes from a search result entry',
  ),
  'up' => 
  array (
    0 => 'ref.ldap.php',
    1 => 'LDAP 函数',
  ),
  'prev' => 
  array (
    0 => 'function.ldap-free-result.php',
    1 => 'ldap_free_result',
  ),
  'next' => 
  array (
    0 => 'function.ldap-get-dn.php',
    1 => 'ldap_get_dn',
  ),
  'alternatives' => 
  array (
  ),
  'source' => 
  array (
    'lang' => 'en',
    'path' => 'reference/ldap/functions/ldap-get-attributes.xml',
  ),
  'history' => 
  array (
  ),
);
$setup["toc"] = $TOC;
$setup["toc_deprecated"] = $TOC_DEPRECATED;
$setup["parents"] = $PARENTS;
manual_setup($setup);

contributors($setup);

?>
<div id="function.ldap-get-attributes" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">ldap_get_attributes</h1>
  <p class="verinfo">(PHP 4, PHP 5, PHP 7, PHP 8)</p><p class="refpurpose"><span class="refname">ldap_get_attributes</span> &mdash; <span class="dc-title">Get attributes from a search result entry</span></p>

 </div>
 
 <div class="refsect1 description" id="refsect1-function.ldap-get-attributes-description">
  <h3 class="title">说明</h3>
  <div class="methodsynopsis dc-description">
   <span class="methodname"><strong>ldap_get_attributes</strong></span>(<span class="methodparam"><span class="type"><a href="class.ldap-connection.php" class="type LDAP\Connection">LDAP\Connection</a></span> <code class="parameter">$ldap</code></span>, <span class="methodparam"><span class="type">LDAP\ResultEntry</span> <code class="parameter">$entry</code></span>): <span class="type"><a href="language.types.array.php" class="type array">array</a></span></div>

  <p class="para rdfs-comment">
   Reads attributes and values from an entry in the search result. 
  </p>
  <p class="para">
   Having located a specific entry in the directory, you can find out what
   information is held for that entry by using this call. You would use this
   call for an application which &quot;browses&quot; directory entries and/or where you
   do not know the structure of the directory entries. In many applications
   you will be searching for a specific attribute such as an email address or
   a surname, and won&#039;t care what other data is held.
   <div class="informalexample">
    <div class="example-contents">
<div class="cdata"><pre>
return_value[&quot;count&quot;] = number of attributes in the entry
return_value[0] = first attribute
return_value[n] = nth attribute

return_value[&quot;attribute&quot;][&quot;count&quot;] = number of values for attribute
return_value[&quot;attribute&quot;][0] = first value of the attribute
return_value[&quot;attribute&quot;][i] = (i+1)th value of the attribute
</pre></div>
    </div>

   </div>
  </p>
 </div>


 <div class="refsect1 parameters" id="refsect1-function.ldap-get-attributes-parameters">
  <h3 class="title">参数</h3>
  <p class="para">
   <dl>
    
     <dt><code class="parameter">ldap</code></dt>
     <dd>
      <p class="para">
       通过 <span class="function"><a href="function.ldap-connect.php" class="function">ldap_connect()</a></span> 返回的 <span class="classname"><a href="class.ldap-connection.php" class="classname">LDAP\Connection</a></span> 实例。
      </p>
     </dd>
    
    
     <dt><code class="parameter">entry</code></dt>
     <dd>
      <p class="para">
       <span class="classname"><a href="class.ldap-result-entry.php" class="classname">LDAP\ResultEntry</a></span> 实例。
      </p>
     </dd>
    
   </dl>
  </p>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-function.ldap-get-attributes-returnvalues">
  <h3 class="title">返回值</h3>
  <p class="para">
   Returns a complete entry information in a multi-dimensional array.
  </p>
 </div>


 <div class="refsect1 changelog" id="refsect1-function.ldap-get-attributes-changelog">
  <h3 class="title">更新日志</h3>
  <table class="doctable informaltable">
   
    <thead>
     <tr>
      <th>版本</th>
      <th>说明</th>
     </tr>

    </thead>

    <tbody class="tbody">
     <tr>
 <td>8.1.0</td>
 <td>
  现在 <code class="parameter">ldap</code> 参数接受 <span class="classname"><a href="class.ldap-connection.php" class="classname">LDAP\Connection</a></span>
  实例，之前接受有效的 <code class="literal">ldap link</code> <span class="type"><a href="language.types.resource.php" class="type resource">resource</a></span>。
 </td>
</tr>

     <tr>
 <td>8.1.0</td>
 <td>
  The <code class="parameter">entry</code> parameter expects an <span class="classname"><a href="class.ldap-result-entry.php" class="classname">LDAP\ResultEntry</a></span>
  instance now; previously, a valid <code class="literal">ldap result entry</code> <span class="type"><a href="language.types.resource.php" class="type resource">resource</a></span> was expected.
 </td>
</tr>

    </tbody>
   
  </table>

 </div>


 <div class="refsect1 examples" id="refsect1-function.ldap-get-attributes-examples">
  <h3 class="title">示例</h3>
  <p class="para">
   <div class="example" id="example-1">
    <p><strong>示例 #1 
     Show the list of attributes held for a particular directory entry
    </strong></p>
    <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000"><span style="color: #0000BB">&lt;?php<br /></span><span style="color: #FF8000">// $ds is a valid LDAP\Connection instance 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 /></span><span style="color: #0000BB">$entry </span><span style="color: #007700">= </span><span style="color: #0000BB">ldap_first_entry</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 /></span><span style="color: #0000BB">$attrs </span><span style="color: #007700">= </span><span style="color: #0000BB">ldap_get_attributes</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">);<br /><br />echo </span><span style="color: #0000BB">$attrs</span><span style="color: #007700">[</span><span style="color: #DD0000">"count"</span><span style="color: #007700">] . </span><span style="color: #DD0000">" attributes held for this entry:&lt;p&gt;"</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">&lt; </span><span style="color: #0000BB">$attrs</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">$attrs</span><span style="color: #007700">[</span><span style="color: #0000BB">$i</span><span style="color: #007700">] . </span><span style="color: #DD0000">"&lt;br /&gt;"</span><span style="color: #007700">;<br />}<br /></span><span style="color: #0000BB">?&gt;</span></span></code></div>
    </div>

   </div>
  </p>
 </div>


 <div class="refsect1 seealso" id="refsect1-function.ldap-get-attributes-seealso">
  <h3 class="title">参见</h3>
  <p class="para">
   <ul class="simplelist">
    <li><span class="function"><a href="function.ldap-first-attribute.php" class="function" rel="rdfs-seeAlso">ldap_first_attribute()</a> - Return first attribute</span></li>
    <li><span class="function"><a href="function.ldap-next-attribute.php" class="function" rel="rdfs-seeAlso">ldap_next_attribute()</a> - Get the next attribute in result</span></li>
   </ul>
  </p>
 </div>


</div><?php manual_footer($setup); ?>