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 linux驱动,linux应用,多线程
  • ¥20 我要一个分身加定位两个功能的安卓app
  • ¥15 基于FOC驱动器,如何实现卡丁车下坡无阻力的遛坡的效果
  • ¥15 IAR程序莫名变量多重定义
  • ¥15 (标签-UDP|关键词-client)
  • ¥15 关于库卡officelite无法与虚拟机通讯的问题
  • ¥15 目标检测项目无法读取视频
  • ¥15 GEO datasets中基因芯片数据仅仅提供了normalized signal如何进行差异分析
  • ¥100 求采集电商背景音乐的方法
  • ¥15 数学建模竞赛求指导帮助