ldap_control_paged_result
(PHP 5 >= 5.4.0, PHP 7)
ldap_control_paged_result — Send LDAP pagination control
    This function has been DEPRECATED as of PHP 7.4.0, and REMOVED as of PHP 8.0.0.
    Instead the controls parameter of ldap_search() should be used.
    See also LDAP Controls for details.
  
說明
resource
$link,int
$pagesize,bool
$iscritical = false,string
$cookie = ""): bool
Enable LDAP pagination by sending the pagination control (page size, cookie...).
參數
- 
link
- 
      An LDAP resource, returned by ldap_connect(). 
- 
pagesize
- 
      The number of entries by page. 
- 
iscritical
- 
      Indicates whether the pagination is critical or not. If true and if the server doesn't support pagination, the search will return no result. 
- 
cookie
- 
      An opaque structure sent by the server (ldap_control_paged_result_response()). 
返回值
   成功時返回 true, 或者在失敗時返回 false。
  
更新日誌
| 版本 | 說明 | 
|---|---|
| 8.0.0 | This function has been removed. | 
| 7.4.0 | This function has been deprecated. | 
範例
The example below show the retrieval of the first page of a search paginated with one entry by page.
示例 #1 LDAP pagination
<?php
     // $ds is a valid link identifier (see ldap_connect)
     ldap_set_option($ds, LDAP_OPT_PROTOCOL_VERSION, 3);
     $dn        = 'ou=example,dc=org';
     $filter    = '(|(sn=Doe*)(givenname=John*))';
     $justthese = array('ou', 'sn', 'givenname', 'mail');
     // enable pagination with a page size of 1.
     ldap_control_paged_result($ds, 1);
     $sr = ldap_search($ds, $dn, $filter, $justthese);
     $info = ldap_get_entries($ds, $sr);
     echo $info['count'] . ' entries returned' . PHP_EOL;
The example below show the retrieval of all the result paginated with 100 entries by page.
示例 #2 LDAP pagination
<?php
     // $ds is a valid link identifier (see ldap_connect)
     ldap_set_option($ds, LDAP_OPT_PROTOCOL_VERSION, 3);
     $dn        = 'ou=example,dc=org';
     $filter    = '(|(sn=Doe*)(givenname=John*))';
     $justthese = array('ou', 'sn', 'givenname', 'mail');
     // enable pagination with a page size of 100.
     $pageSize = 100;
     $cookie = '';
     do {
         ldap_control_paged_result($ds, $pageSize, true, $cookie);
         $result  = ldap_search($ds, $dn, $filter, $justthese);
         $entries = ldap_get_entries($ds, $result);
             
         foreach ($entries as $e) {
             echo $e['dn'] . PHP_EOL;
         }
         ldap_control_paged_result_response($ds, $result, $cookie);
       
     } while($cookie !== null && $cookie != '');
註釋
注意:
Pagination control is a LDAPv3 protocol feature.
參見
- ldap_control_paged_result_response() - Retrieve the LDAP pagination cookie
- » RFC2696 : LDAP Control Extension for Simple Paged Results Manipulation