Ldap_add():语法无效
我这里有一个使用 ldap_add 的程序, 当我尝试运行该程序时,它显示 错误:
警告:ldap_add() [function.ldap-add]:添加:语法无效 /var/www/suey/costcenter.20090617.php 第 780 行
我的小代码是:
$ldapservers = 'ourServer';
$ds = ldap_connect($ldapservers);
if ($ds) {
$r = ldap_bind($ds, $ldaprootun, $ldaprootpw);
$add = ldap_add($ds, "uid=$fuid, $ldapbasedn", $infonew);
}
ldapbasedn 设置为 o=ourGroup;
infonew 是一个条目数组(个人信息) 我非常确定该数组不为空,因为我已经测试过它。 uid 也不为空。 可能出什么问题了? 是条目(数组)吗? 或者服务器正在尝试连接? 我尝试测试 ldap_bind,它也工作得很好..嗯..
请帮助..谢谢!
我发现了问题..它在索引 infonew["createdBy"] = getenv("REMOTE_USER"); 中 它返回 NULL! 现在,是吗?
I have a program here that uses the ldap_add,
when i try to run the program, it displays an
error:
Warning: ldap_add() [function.ldap-add]: Add: Invalid syntax in
/var/www/suey/costcenter.20090617.php on line 780
My lil' code here is:
$ldapservers = 'ourServer';
$ds = ldap_connect($ldapservers);
if ($ds) {
$r = ldap_bind($ds, $ldaprootun, $ldaprootpw);
$add = ldap_add($ds, "uid=$fuid, $ldapbasedn", $infonew);
}
ldapbasedn is set to o=ourGroup;
infonew is an array of entries (person information)
and am so sure that the array is not empty because i already tested it.
the uid is not empty too.
What could be wrong? Is it the entries(array)? or the server am trying to connect to?
I tried testing the ldap_bind, and it also works well too..hmmm..
Pls help.. thanks!
I found the problem.. it's in the index infonew["createdBy"] = getenv("REMOTE_USER");
it returns NULL! now, is that right?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以发布
var_dump($infonew)
(或print_r($infonew)
)吗?我强烈假设
$infonew
中有一些数据无法写入 LDAP 服务器。编辑:
您不能在 LDAP 数据数组中使用
null
。 从数组中删除适当的键 (createdBy
) 或将值设置为array()
。Can you please post a
var_dump($infonew)
(orprint_r($infonew)
)?I strongly assume that there is some data in
$infonew
that cannot be written to the LDAP server.EDIT:
You cannot use
null
in the LDAP data array. Either strip the appropriate key (createdBy
) from the array or set the value toarray()
.