如何根据" ou"在LDAP中对结果进行分组或排列。 OU有4个或更多类别并正确显示。如何使用PHP和HTML执行此操作?请帮我。我是LDAP的新手
OU示例
ou=web service
ou=department
ou=city
如何显示这样的结果?
sn dn mail ou
user cn=user,ou=web service,dc=domain,dc=com example@domain.com web service
sn dn mail ou
user cn=user,ou=department,dc=domain,dc=com example@domain.com department
这是PHP数组
$dn = 'dc=domain,dc=com';
$filter = "(|(sn=$person*)(fullname=$person*))";
$ldaparray = array ("ou", "sn", "fullname", "mail");
$sr=ldap_search($ldapconn, $dn, $filter, $ldaparray);
$info = ldap_get_entries($ldapconn, $sr);
echo "<pre>";
print_r ($info);
echo "</pre>";
使用print_r输出
Array
(
[count] => 1409
[0] => Array
(
[sn] => Array
(
[count] => 1
[0] => user
)
[0] => sn
[count] => 1
[dn] => cn=username,ou=web service,dc=domain,dc=com
)
[1] => Array
(
[sn] => Array
(
[count] => 1
[0] => user
)
[0] => sn
[mail] => Array
(
[count] => 1
[0] => example@domain.com
)
[1] => mail
[count] => 2
[dn] => uid=userid,ou=department,dc=doamin,dc=com
)