本文整理汇总了PHP中Zend\Ldap\Ldap::getLastError方法的典型用法代码示例。如果您正苦于以下问题:PHP Ldap::getLastError方法的具体用法?PHP Ldap::getLastError怎么用?PHP Ldap::getLastError使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zend\Ldap\Ldap
的用法示例。
在下文中一共展示了Ldap::getLastError方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: next
/**
* Move forward to next result item
* Implements Iterator
*
* @throws \Zend\Ldap\Exception
*/
public function next()
{
if (is_resource($this->_current)) {
$this->_current = @ldap_next_entry($this->_ldap->getResource(), $this->_current);
if ($this->_current === false) {
$msg = $this->_ldap->getLastError($code);
if ($code === Ldap\Exception::LDAP_SIZELIMIT_EXCEEDED) {
// we have reached the size limit enforced by the server
return;
} else {
if ($code > Ldap\Exception::LDAP_SUCCESS) {
throw new Ldap\Exception($this->_ldap, 'getting next entry (' . $msg . ')');
}
}
}
}
}
示例2: next
/**
* Move forward to next result item
* Implements Iterator
*
* @throws \Zend\Ldap\Exception\LdapException
* @return
*/
public function next()
{
$code = 0;
if (is_resource($this->current) && $this->itemCount > 0) {
$this->current = @ldap_next_entry($this->ldap->getResource(), $this->current);
if ($this->current === false) {
$msg = $this->ldap->getLastError($code);
if ($code === Exception\LdapException::LDAP_SIZELIMIT_EXCEEDED) {
// we have reached the size limit enforced by the server
return;
} elseif ($code > Exception\LdapException::LDAP_SUCCESS) {
throw new Exception\LdapException($this->ldap, 'getting next entry (' . $msg . ')');
}
}
} else {
$this->current = false;
}
}
示例3: __construct
/**
* @param Ldap $ldap Zend\Ldap\Ldap object
* @param string $str Informative exception message
* @param int $code LDAP error code
*/
public function __construct(Ldap $ldap = null, $str = null, $code = 0)
{
$errorMessages = array();
$message = '';
if ($ldap !== null) {
$oldCode = $code;
$message = $ldap->getLastError($code, $errorMessages) . ': ';
if ($code === 0) {
$message = '';
$code = $oldCode;
}
}
if (empty($message)) {
if ($code > 0) {
$message = '0x' . dechex($code) . ': ';
}
}
if (!empty($str)) {
$message .= $str;
} else {
$message .= 'no exception message';
}
parent::__construct($message, $code);
}