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#的问题(输入输出错误):出现这个界面接着我重新装系统,又让修电脑的师傅帮我扫描硬盘(没有问题)用着用着又卡死(相关搜索:固态硬盘)
  • ¥15 cv::resize不同线程时间不同
  • ¥15 web课程,怎么做啊😭没好好听课 根本不知道怎么下手
  • ¥15 做一个关于单片机的比较难的代码,然后搞一个PPT进行解释
  • ¥15 python提取.csv文件中的链接会经常出现爬取失败
  • ¥15 数据结构中的数组地址问题
  • ¥15 maya的mel里,怎样先选择模型A,然后利用mel脚本自动选择有相同名字的模型B呢。
  • ¥15 Python题,根本不会啊
  • ¥15 会会信号与系统和python的来
  • ¥15 关于#python#的问题