本文整理汇总了PHP中Net_LDAP2::getLink方法的典型用法代码示例。如果您正苦于以下问题:PHP Net_LDAP2::getLink方法的具体用法?PHP Net_LDAP2::getLink怎么用?PHP Net_LDAP2::getLink使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Net_LDAP2
的用法示例。
在下文中一共展示了Net_LDAP2::getLink方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
/**
* Internal Constructor
*
* Constructor of the entry. Sets up the distinguished name and the entries
* attributes.
* You should not call this method manually! Use {@link Net_LDAP2_Entry::createFresh()}
* or {@link Net_LDAP2_Entry::createConnected()} instead!
*
* @param Net_LDAP2|ressource|array $ldap Net_LDAP2 object, ldap-link ressource or array of attributes
* @param string|ressource $entry Either a DN or a LDAP-Entry ressource
*
* @access protected
* @return none
*/
public function __construct($ldap, $entry = null)
{
parent::__construct('Net_LDAP2_Error');
// set up entry resource or DN
if (is_resource($entry)) {
$this->_entry = $entry;
} else {
$this->_dn = $entry;
}
// set up LDAP link
if ($ldap instanceof Net_LDAP2) {
$this->_ldap = $ldap;
$this->_link = $ldap->getLink();
} elseif (is_resource($ldap)) {
$this->_link = $ldap;
} elseif (is_array($ldap)) {
// Special case: here $ldap is an array of attributes,
// this means, we have no link. This is a "virtual" entry.
// We just set up the attributes so one can work with the object
// as expected, but an update() fails unless setLDAP() is called.
$this->setAttributes($ldap);
}
// if this is an entry existing in the directory,
// then set up as old and fetch attrs
if (is_resource($this->_entry) && is_resource($this->_link)) {
$this->_new = false;
$this->_dn = @ldap_get_dn($this->_link, $this->_entry);
$this->setAttributes();
// fetch attributes from server
}
}