本文整理匯總了PHP中Zend\Ldap\Ldap::getLastErrorCode方法的典型用法代碼示例。如果您正苦於以下問題:PHP Ldap::getLastErrorCode方法的具體用法?PHP Ldap::getLastErrorCode怎麽用?PHP Ldap::getLastErrorCode使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Zend\Ldap\Ldap
的用法示例。
在下文中一共展示了Ldap::getLastErrorCode方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: rewind
/**
* Rewind the Iterator to the first result item
* Implements Iterator
*
* @throws \Zend\Ldap\Exception
*/
public function rewind()
{
if (is_resource($this->_resultId)) {
$this->_current = @ldap_first_entry($this->_ldap->getResource(), $this->_resultId);
if ($this->_current === false && $this->_ldap->getLastErrorCode() > Ldap\Exception::LDAP_SUCCESS) {
throw new Ldap\Exception($this->_ldap, 'getting first entry');
}
}
}
示例2: rewind
/**
* Rewind the Iterator to the first result item
* Implements Iterator
*
*
* @throws \Zend\Ldap\Exception\LdapException
*/
public function rewind()
{
if (is_resource($this->resultId)) {
ErrorHandler::start();
$this->current = ldap_first_entry($this->ldap->getResource(), $this->resultId);
ErrorHandler::stop();
if ($this->current === false && $this->ldap->getLastErrorCode() > Exception\LdapException::LDAP_SUCCESS) {
throw new Exception\LdapException($this->ldap, 'getting first entry');
}
}
}
示例3: testGetErrorCode
public function testGetErrorCode()
{
$ldap = new Ldap\Ldap($this->options);
try {
// Connect doesn't actually try to connect until bind is called
// but if we get 'Invalid credentials' then we know the connect
// succeeded.
$ldap->connect()->bind('CN=ignored,DC=example,DC=com', 'ignored');
$this->fail('Expected exception for invalid username');
} catch (Exception\LdapException $zle) {
$this->assertContains('Invalid credentials', $zle->getMessage());
$this->assertEquals(0x31, $zle->getCode());
$this->assertEquals(0x0, $ldap->getLastErrorCode());
}
}