Php/docs/function.ldap-control-paged-result

提供:Dev Guides
< Php
移動先:案内検索

ldap_control_paged_result

(PHP 5 >= 5.4.0, PHP 7)

ldap_control_paged_resultLDAP ページネーション制御情報を送信する


警告 この関数は PHP 7.4.0 で 非推奨になります。この関数に頼らないことを強く推奨します。


説明

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

LDAP ページネーションを有効にするため、ページネーション制御情報 (ページサイズやクッキーなど) を送信します。


パラメータ

link
ldap_connect() が返す LDAP リンク ID。
pagesize
ページあたりのエントリ数。
iscritical
ページネーションを必須にするかどうか。 true にすると、もしサーバーがページネーションに対応していなければ 検索結果を返しません。
cookie
サーバーから送られる opaque structure (ldap_control_paged_result_response())。


返り値

成功した場合に true を、失敗した場合に false を返します。


変更履歴

バージョン 説明
7.4.0 この関数は非推奨になりました。


次の例は、検索結果の最初のページを取得します。 ページあたり 1 エントリになります。

例1 LDAP ページネーション

<?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 ページネーション

<?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 プロトコルの機能です。