略微加速

PHP官方手册 - 互联网笔记

PHP - Manual: ldap_next_entry

2024-12-22

ldap_next_entry

(PHP 4, PHP 5, PHP 7, PHP 8)

ldap_next_entryGet next result entry

说明

ldap_next_entry(LDAP\Connection $ldap, LDAP\ResultEntry $entry): LDAP\ResultEntry|false

Retrieve the entries stored in the result. Successive calls to the ldap_next_entry() return entries one by one till there are no more entries. The first call to ldap_next_entry() is made after the call to ldap_first_entry() with the entry as returned from the ldap_first_entry().

参数

ldap

通过 ldap_connect() 返回的 LDAP\Connection 实例。

entry

LDAP\ResultEntry 实例。

返回值

Returns an LDAP\ResultEntry instance for the next entry in the result whose entries are being read starting with ldap_first_entry(). If there are no more entries in the result then it returns false.

更新日志

版本 说明
8.1.0 现在 ldap 参数接受 LDAP\Connection 实例,之前接受 资源(resource)
8.1.0 The entry parameter expects an LDAP\ResultEntry instance now; previously, a 资源(resource) was expected.
8.1.0 Returns an LDAP\Result instance now; previously, a 资源(resource) was returned.

参见

add a noteadd a note

User Contributed Notes 1 note

up
0
me at xbug dot de
7 years ago
This is working for me in php 5.5:

<?php
$ldap_host
= 'ldap://ldap.example.com';
$base_dn = "ou=users,dc=example,dc=com";
$connect = ldap_connect($ldap_host);

$result = ldap_search($connect, $base_dn, "(cn=*)");

$entry = ldap_first_entry($connect, $result);

do {
   
$dn = ldap_get_dn($connect, $entry);
    echo
"DN is $dn\n";
} while (
$entry = ldap_next_entry($connect, $entry));

ldap_close($connect);
?>

官方地址:https://www.php.net/manual/en/function.ldap-next-entry.php

北京半月雨文化科技有限公司.版权所有 京ICP备12026184号-3