本文整理匯總了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
}
}