首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > PHP >

LDAP-Series-一-Chapter-3 - PHP-LDAP

2013-11-09 
LDAP-Series-1-Chapter-3 - PHP-LDAPIf you want to use PHP with ldap. You have to add the extension l

LDAP-Series-1-Chapter-3 - PHP-LDAP

If you want to use PHP with ldap. You have to add the extension lib.(ldap.so)

Go to the install file of PHP.

<?php        require_once("m_ldap.php");        $mdap=new m_ldap();        $mdap->m_ldap_con();        $dn = "cn=root,ou=SystemAdmin,dc=xxx,dc=org";        $psw= "xxxxxx";        $mdap->m_ldap_bind($dn,$psw) or die("cannot bind");                $sdn="ou=people,ou=iWeb,dc=weiwejia,dc=org";        $filter="(uid=*)";        $res=$mdap->m_ldap_search($sdn,$filter);        foreach( $res[0]["cn"] as $key=>$val){                print $key."\n";                print $val."\n";        }?>
If everything has been ok, it will works now. (Need ACL support, introduce next chapter.)




热点排行