當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Ldap::getResource方法代碼示例

本文整理匯總了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');
         }
     }
 }
開發者ID:rexmac,項目名稱:zf2,代碼行數:15,代碼來源:DefaultIterator.php

示例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');
         }
     }
 }
開發者ID:haoyanfei,項目名稱:zf2,代碼行數:18,代碼來源:DefaultIterator.php

示例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');
     }
 }
開發者ID:zendframework,項目名稱:zend-ldap,代碼行數:31,代碼來源:DefaultIterator.php

示例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);
 }
開發者ID:rikaix,項目名稱:zf2,代碼行數:17,代碼來源:ConnectTest.php

示例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());
 }
開發者ID:heiglandreas,項目名稱:zf2,代碼行數:10,代碼來源:BindTest.php


注:本文中的Zend\Ldap\Ldap::getResource方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。