并行搜索示例
<?php
$basedn=array('dmdName=users,dc=foo,dc=fr','dmdName=users,dc=bar,dc=com'); $filter='(&(objectClass=inetOrgPerson)(uid=*))'; $attributes=array('dn','uid','sn');
$cnx = ldap_connect('localhost',389); ldap_set_option($cnx, LDAP_OPT_PROTOCOL_VERSION, 3);
ldap_bind($cnx,'uid=root,dc=foo,dc=fr','password'); ldap_bind($cnx,'uid=root,dc=bar,dc=com','password');
$search = ldap_search(array($cnx,$cnx),$basedn,$filter,$attributes); for($i=0;$i<count($search);$i++){
print_r(ldap_get_entries($cnx,$search[$i]));
print "\n";
}
?>