【发布时间】:2011-06-28 13:49:37
【问题描述】:
Ldap 身份验证有效。我只想使用 php 从 Ldap 获取 samaccountname。我可以获取用户的电子邮件、OU 和显示名称,但是有没有办法获取 SamAccountName?
我正在使用这个:
if (@!$loginldap = ldap_bind($ds, "$username@$ldap_domain", $password)) {
if ($loginldap) { // if binding to ldap works
$attributes = array("displayname", "mail");
$filter = "(&(objectCategory=person)(sAMAccountName=$username))";
$result = ldap_search($ds, $ldap_dn, $filter, $attributes);
$entries = ldap_get_entries($ds, $result);
}
}
$entries 数组包含我需要的所有东西,除了 SamAccountName。
谢谢。
【问题讨论】: