我想使用adldap php获取所有用户显示名称记录形式的活动目录吗?
此代码可以获取单个记录。
if ($adldap->authenticate($username, $password)){
$result=$adldap->user()->infoCollection("$username", array("*"))->displayName;
print_r($result);
}
但是我想从活动目录中获取所有显示名称记录,我尝试了以下代码,但不起作用
if ($adldap->authenticate($username, $password)){
$result=$adldap->user()->infoCollection("*")->displayName; //show all record
print_r($result);
}
任何想法,非常感谢
答案 0 :(得分:0)
您需要进行搜索以收集所有用户-有关文档,请参见https://github.com/adldap/adLDAP/blob/master/docs/SEARCH-FUNCTIONS.md。根据您的AD中有多少条记录,您可能希望使用分页查询。有关详情,请参见https://github.com/adldap/adLDAP/blob/master/docs/SEARCH-FUNCTIONS.md#paginate。
拥有结果集后,请遍历结果集并获取每个用户的显示名称:
foreach($results as $result){
echo $result['displayName'];
}