PHP Openldap 检索所有要求的属性但是 "location"

PHP Openldap retrive all attributes asked but "location"

我正在制作一本 phone 书,一切都很好:

然后我的老板让我添加 Location 属性,也就是法语的 "Bureau",但是 openldap 不会检索它,只会检索它。

代码如下:

$attributes = array();
$attributes[] = 'givenname';
$attributes[] = 'sn';
$attributes[] = 'samaccountname';
$attributes[] = 'mail';
$attributes[] = 'telephonenumber';
$attributes[] = 'useraccountcontrol';
$attributes[] = 'dn';
$attributes[] = 'location';

/*------------------------------------------------------------------------------*/
if ($ldap_bind) // Si la connexon s'est effectuée
{
    // Query sur LDAP
    $resultat = ldap_search($ldap_connect, $dn, $search_filter, $attributes) or die('Une erreur est survenue pendant la recherche.');

    // Transformation de l'objet LDAP en données explotables
    $entries = ldap_get_entries($ldap_connect, $resultat);

但是当我 var_dump($entries) 时,location 属性不在数组中,就像 name 属性错误一样。但根据 msdn 这是正确拼写的正确属性。

所以现在我向你求助,希望有人能在这个问题上提供帮助。

在LDAP中,如果没有设置该属性,则不会检索为空,但不会在响应条目数组中设置。

检索条目的每个属性并var_dump查看它是否已设置。