本文整理匯總了PHP中Ldap::find方法的典型用法代碼示例。如果您正苦於以下問題:PHP Ldap::find方法的具體用法?PHP Ldap::find怎麽用?PHP Ldap::find使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Ldap
的用法示例。
在下文中一共展示了Ldap::find方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: Ldap
<?php
$q = $_GET["q"];
if (!q) {
return;
}
require "../core/ldap.php";
$ldap = new Ldap();
$userinfos = $ldap->find(array("cn" => "*{$q}*"), array("cn", "uid"));
foreach ($userinfos as $userinfo) {
echo $userinfo['cn'] . "|" . $userinfo['uid'] . "\n";
}
示例2: getUserInfoFromLdap
function getUserInfoFromLdap($fields = array("sn", "cn", "givenname", "uisid"))
{
$ldap = new Ldap();
$userdata = $ldap->find(array("uid" => $this->username), $fields);
// ak zadany user nie je korektny v ramci LDAPu
if (empty($userdata)) {
return false;
}
$this->fullname = addslashes($userdata[0]["cn"]);
$this->meno = addslashes($userdata[0]["givenname"]);
$this->priezvisko = addslashes($userdata[0]["sn"]);
$this->ais_id = addslashes($userdata[0]["uisid"]);
// tituly stuff
if (preg_match("/^(.*) {$this->meno}/", $this->fullname, $matches)) {
$this->tituly_pred = $matches[1];
} else {
$this->tituly_pred = "";
}
if (preg_match("/{$this->priezvisko}, (.*)\$/", $this->fullname, $matches)) {
$this->tituly_za = $matches[1];
} else {
$this->tituly_za = "";
}
return true;
}