更新时间:2022-06-19 22:36:19
我可能是错的,但是从我在您的代码中看到的内容来看,您有一个条目OU=Advertising,OU=EmailDepartmentAccounts,OU=Administration,OU=Central,DC=domain,DC=co,DC=uk
.据我解释您的代码,您想在该条目的下方添加一个条目.但是您必须提供 new 条目的DN作为ldap_add
的第二个参数.但是,您需要提供新条目的 baseDN .那已经在那里.否则,您将无法向其中添加某些内容.
I might be wrong, but from what I read in your code you have an entry OU=Advertising,OU=EmailDepartmentAccounts,OU=Administration,OU=Central,DC=domain,DC=co,DC=uk
. And as far as I interpret your code you want to add an entry below that entry. But you have to provide the DN of the new entry as second parameter to ldap_add
. But you provide the baseDN of the new entry. and that is already there. Otherwise you wouldn't be able to add something into it.
因此,在调用ldap_add
之前,应先调用类似以下的内容:
So you should call something like the following before calling the ldap_add
:
$dn = 'cn=' . $NewUser['cn'][0] . ',' . $dn;
它使用baseDN并在其前面加上当前用户的cn.
That uses the baseDN and prepends it with the cn of the current user.
希望有帮助