我尝试过新代码,但仍然存在以下错误凭据无效
<?php
$username = "cwahyono";
$password = "1234";
$ldapconfig['host'] = '10.0.0.120';
$ldapconfig['port'] = '389';
$ldapconfig['basedn'] = 'dc=10,dc=0,dc=0,dc=120';
$ldapconfig['usersdn'] = 'cn=admin';
$ds=ldap_connect($ldapconfig['host'], $ldapconfig['port']);
ldap_set_option($ds, LDAP_OPT_PROTOCOL_VERSION, 3);
ldap_set_option($ds, LDAP_OPT_REFERRALS, 0);
ldap_set_option($ds, LDAP_OPT_NETWORK_TIMEOUT, 10);
$dn="uid=".$username.",".$ldapconfig['usersdn'].",".$ldapconfig['basedn'];
if ($bind=ldap_bind($ds, $dn, $password)) {
echo "LOGIN BERHASIL!";
} else {
echo "Login Failed: Please check your username or password";
}
?>
我是新手ldap请帮我解决这个问题