LDAP ldap_control_paged_result

(PHP 5 >= 5.4.0, PHP 7)

ldap_control_paged_result — LDAP 페이지 매김 제어 보내기

경고 이 함수는 PHP 7.4.0부터 DEPRECATED되었으며 PHP 8.0.0부터 제거되었습니다. 대신 ldap_search()의 제어 매개변수를 사용해야 합니다. 자세한 내용은 LDAP 컨트롤을 참조하십시오.


설명

ldap_control_paged_result(
    resource $link,
    int $pagesize,
    bool $iscritical = false,
    string $cookie = ""
): bool
                

페이지 매김 제어(페이지 크기, 쿠키...)를 전송하여 LDAP 페이지 매김을 활성화합니다.


매개변수

link
ldap_connect()에서 반환된 LDAP 리소스입니다.
pagesize
페이지별 항목 수입니다.
iscritical
페이지 매김이 중요한지 여부를 나타냅니다. true이고 서버가 페이지 매김을 지원하지 않는 경우 검색은 결과를 반환하지 않습니다.
cookie
서버에서 보낸 불투명한 구조(ldap_control_paged_result_response()).

반환 값

성공하면 true를, 실패하면 false를 반환합니다.


변경 로그

버전 설명
8.0.0 이 함수는 제거되었습니다.
7.4.0 이 함수는 더 이상 사용되지 않습니다.

Examples

아래 예는 페이지별로 한 항목으로 페이지가 매겨진 검색의 첫 번째 페이지를 검색하는 것을 보여줍니다.

예제 #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;
                  
                

아래 예는 페이지별로 100개 항목으로 페이지가 매겨진 모든 결과의 검색을 보여줍니다.

예제 #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 != '');
                  
                

메모

참고: 페이지 매김 제어는 LDAPv3 프로토콜 기능입니다.


기타