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