本文整理汇总了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;
}