本文整理汇总了PHP中Zend\Ldap\Ldap::getResource方法的典型用法代码示例。如果您正苦于以下问题:PHP Ldap::getResource方法的具体用法?PHP Ldap::getResource怎么用?PHP Ldap::getResource使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zend\Ldap\Ldap
的用法示例。
在下文中一共展示了Ldap::getResource方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: sort
/**
* Sort the iterator
*
* Sorting is done using the set sortFunction which is by default strnatcasecmp.
*
* The attribute is determined by lowercasing everything.
*
* The sort-value will be the first value of the attribute.
*
* @param string $sortAttribute The attribute to sort by. If not given the
* value set via setSortAttribute is used.
*
* @return void
*/
public function sort($sortAttribute)
{
foreach ($this->entries as $key => $entry) {
$attributes = ldap_get_attributes($this->ldap->getResource(), $entry['resource']);
$attributes = array_change_key_case($attributes, CASE_LOWER);
if (isset($attributes[$sortAttribute][0])) {
$this->entries[$key]['sortValue'] = $attributes[$sortAttribute][0];
}
}
$sortFunction = $this->sortFunction;
$sorted = usort($this->entries, function ($a, $b) use($sortFunction) {
return $sortFunction($a['sortValue'], $b['sortValue']);
});
if (!$sorted) {
throw new Exception\LdapException($this, 'sorting result-set');
}
}
示例4: testExplicitNetworkTimeoutConnect
public function testExplicitNetworkTimeoutConnect()
{
$networkTimeout = 1;
$host = TESTS_ZEND_LDAP_HOST;
$port = 0;
if (defined('TESTS_ZEND_LDAP_PORT') && TESTS_ZEND_LDAP_PORT != 389) {
$port = TESTS_ZEND_LDAP_PORT;
}
$useSsl = false;
if (defined('TESTS_ZEND_LDAP_USE_SSL')) {
$useSsl = TESTS_ZEND_LDAP_USE_SSL;
}
$ldap = new Ldap\Ldap();
$ldap->connect($host, $port, $useSsl, null, $networkTimeout);
ldap_get_option($ldap->getResource(), LDAP_OPT_NETWORK_TIMEOUT, $actual);
$this->assertEquals($networkTimeout, $actual);
}
示例5: testResourceIsAlwaysReturned
/**
* @group ZF-8259
*/
public function testResourceIsAlwaysReturned()
{
$ldap = new Ldap\Ldap($this->_options);
$this->assertNotNull($ldap->getResource());
$this->assertTrue(is_resource($ldap->getResource()));
$this->assertEquals(TESTS_ZEND_LDAP_USERNAME, $ldap->getBoundUser());
}