2012-03-13 72 views
2

我想查看的LDAP操作屬性,如nsAccountLookup,pwdAccountLockedTime等PHP LDAP操作屬性查詢

當我看着被返回的屬性我沒有看到那些在列表中。以下是我正在使用的代碼...有什麼建議嗎?

$ds = ldap_connect($ldaphost, $ldapport) 
$dn="ou=People,o=companyName"; 
$filterUID = "(uid=$uid)"; 
$result = ldap_search($ds, $dn, $filterUID); 
$entries = ldap_get_entries($ds, $result); 
$lock= $entries[0]["nsAccountLock"][0]; 

要更清楚一點 - 如何查看更多的操作屬性?

+0

建議:UID是無效的。 – hakre 2012-03-13 13:12:34

+0

@hakre uid是我的uid - 其他屬性會返回正常。 – 2012-03-13 13:14:06

回答

3

您必須指定屬性你想從LDAP獲得的第四個參數中ldap_search()功能:

$attributes = array('nsAccountLock'); 
$result = ldap_search($ds, $dn, $filterUID, $attributes); 
+0

完美!我犯了一個錯誤,認爲不指定屬性會返回所有可用的屬性。感謝您解決我愚蠢的假設:) – 2012-03-13 13:23:03

0

必須在請求的屬性列表中明確請求操作屬性,並且必須配置目錄服務器以允許它們返回。