未在PHP中检索Active Directory属性

未在PHP中检索Active Directory属性,php,active-directory,Php,Active Directory,我试图在PHP应用程序中检索用户的广告属性。我成功绑定并能够检索属性。我有一个名为“Cust1”的自定义属性,在LDAP调用中无法检索该属性。除此之外,还将检索所有属性 我的代码: $ldap_server_url = "<<server_url>>"; ##GLOBAL CATALOG## $ldap_bind_dn = '<<bind dn>>'; $ldap_bind_dn_password = '<<bind password&

我试图在PHP应用程序中检索用户的广告属性。我成功绑定并能够检索属性。我有一个名为“Cust1”的自定义属性,在LDAP调用中无法检索该属性。除此之外,还将检索所有属性

我的代码:

$ldap_server_url = "<<server_url>>"; ##GLOBAL CATALOG##
$ldap_bind_dn = '<<bind dn>>';
$ldap_bind_dn_password = '<<bind password>>';

$ldapconn = ldap_connect($ldap_server_url);
$ldap_bind = @ldap_bind($ldapconn, $ldap_bind_dn, $ldap_bind_dn_password);
$attr = array('*');
$test = ldap_search($ldapconn, "dc=mydomain,dc=com", "(samaccountname=mydemouser)", $attr);
$entry = ldap_first_entry($ldapconn, $test);

$attrs = ldap_get_attributes($ldapconn, $entry);
var_dump($attrs);
$ldap_server_url=”“##全球目录##
$ldap_bind_dn='';
$ldap\u bind\u dn\u password='';
$ldapconn=ldap\u connect($ldap\u server\u url);
$ldap\u bind=@ldap\u bind($ldapconn,$ldap\u bind\u dn,$ldap\u bind\u dn\u password);
$attr=数组('*');
$test=ldap\u search($ldapconn,“dc=mydomain,dc=com”,“samaccountname=mydemouser)”,$attr);
$entry=ldap\u first\u条目($ldapconn,$test);
$attrs=ldap\u get\u属性($ldapconn,$entry);
var_dump($attrs);

是否需要执行某些操作才能检索此值?

以确保Active Directory中对象的特定属性在全局目录中可用,并且在尝试在php中的ldap搜索中显示时可见,必须在架构中修改这些属性


当您直接从cmd行(dsquery)或类似方法查询广告时,是否会显示自定义属性?否。这是因为我试图在我的广告林中查询全局目录吗?我已经添加了相应的属性,但您是否通过勾选Schema Admin中的相应框来确保该属性在全局目录中可用?我刚刚这样做了,它成功了。谢谢。如果你加一个答案,我会把它标为正确答案。