ldap_add
增加 LDAP 名录的条目。
语法: boolean ldap_add(int handle, string dn, array entry);
传回值: 布林值
函式种类: 网路系统
本函式用来加入新的条目到 LDAP 名录之中。参数 handle 为开启 LDAP 的代号。参数 dn 为要加入条目的具体 dn 字串。参数 entry 为阵列,为个体所有的条目,阵列的内容是条目的相关资讯。若无错误则传回 true 值。
<?php $ds=ldap_connect("localhost"); // 连上 LDAP 伺服器 if ($ds) { // 系住恰当的 dn $r=ldap_bind($ds,"cn=root, o=A2Z Company, c=TW", "secret"); // 预先准备好新条目的资料 $info["cn"]="Wilson Peng"; $info["sn"]="Peng"; $info["mail"]="wilson@wilson.gs"; $info["objectclass"]="person"; // 加入新条目 $r=ldap_add($ds, "cn=Wilson Peng, o=A2Z Company, c=TW", $info); ldap_close($ds); } else { echo "抱歉,无法连上 LDAP 伺服器。"; } ?>
|