当前位置: 首页>>代码示例>>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;未经允许,请勿转载。