dongzhan3937 2017-04-06 09:08
浏览 59
已采纳

PHP Openldap检索所有要求的属性,但“位置”

I'm making a sort of phone book and everything is fine:

  • Connection and authentification works perfectly
  • Research goes aswell
  • I can modify user's attributes

Then my boss asked me to add the Location attribute aka "Bureau" in french but openldap won't retrive it and only it.

Here's the code :

$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);

But when I var_dump($entries), the location attribute isn't in the array, like if the name attribute was wrong. But according to msdn it's the right attribute correctly spelled.

So now I turn myself to you in hope someone can help on this issue.

  • 写回答

1条回答 默认 最新

  • douxidao3524 2017-05-12 10:19
    关注

    In LDAP, if the attribute is not set, it will not be retrieved empty but will not be set in the response entry array.

    Retrieve every attribute of the entry and var_dump it to see if it is set.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 delta降尺度计算的一些细节,有偿
  • ¥15 Arduino红外遥控代码有问题
  • ¥15 数值计算离散正交多项式
  • ¥30 数值计算均差系数编程
  • ¥15 redis-full-check比较 两个集群的数据出错
  • ¥15 Matlab编程问题
  • ¥15 训练的多模态特征融合模型准确度很低怎么办
  • ¥15 kylin启动报错log4j类冲突
  • ¥15 超声波模块测距控制点灯,灯的闪烁很不稳定,经过调试发现测的距离偏大
  • ¥15 import arcpy出现importing _arcgisscripting 找不到相关程序