LDAP ldap_set_option
(PHP 4 >= 4.0.4, PHP 5, PHP 7, PHP 8)
ldap_set_option — 주어진 옵션의 값을 설정
설명
ldap_set_option(?LDAP\Connection $ldap
, int $option
, array|string|int|bool $value
): bool
지정된 옵션의 값을 value
로 설정합니다.
매개변수
ldap
- ldap_connect()에 의해 반환된 LDAP\Connection 인스턴스는 해당 연결에 대한 옵션을 설정하고
null
은 옵션을 전역적으로 설정합니다. option
- 매개변수
option
은 다음 중 하나일 수 있습니다.Option Type Available since LDAP_OPT_DEREF
int LDAP_OPT_SIZELIMIT
int LDAP_OPT_TIMELIMIT
int LDAP_OPT_NETWORK_TIMEOUT
int LDAP_OPT_PROTOCOL_VERSION
int LDAP_OPT_ERROR_NUMBER
int LDAP_OPT_REFERRALS
bool LDAP_OPT_RESTART
bool LDAP_OPT_HOST_NAME
string LDAP_OPT_ERROR_STRING
string LDAP_OPT_DIAGNOSTIC_MESSAGE
string LDAP_OPT_MATCHED_DN
string LDAP_OPT_SERVER_CONTROLS
array LDAP_OPT_CLIENT_CONTROLS
array LDAP_OPT_X_KEEPALIVE_IDLE
int PHP 7.1.0 LDAP_OPT_X_KEEPALIVE_PROBES
int PHP 7.1.0 LDAP_OPT_X_KEEPALIVE_INTERVAL
int PHP 7.1.0 LDAP_OPT_X_TLS_CACERTDIR
string PHP 7.1.0 LDAP_OPT_X_TLS_CACERTFILE
string PHP 7.1.0 LDAP_OPT_X_TLS_CERTFILE
string PHP 7.1.0 LDAP_OPT_X_TLS_CIPHER_SUITE
string PHP 7.1.0 LDAP_OPT_X_TLS_CRLCHECK
int PHP 7.1.0 LDAP_OPT_X_TLS_CRLFILE
string< PHP 7.1.0 LDAP_OPT_X_TLS_DHFILE
string PHP 7.1.0 LDAP_OPT_X_TLS_KEYFILE
string PHP 7.1.0 LDAP_OPT_X_TLS_PROTOCOL_MIN
int PHP 7.1.0 LDAP_OPT_X_TLS_RANDOM_FILE
string PHP 7.1.0 LDAP_OPT_X_TLS_REQUIRE_CERT
int PHP 7.0.5 LDAP_OPT_SERVER_CONTROLS
및LDAP_OPT_CLIENT_CONTROLS
에는 제어 목록이 필요합니다. 이는 값이 제어 배열이어야 함을 의미합니다. 컨트롤은 컨트롤을 식별하는 oid, 선택적 값 및 중요도에 대한 선택적 플래그로 구성됩니다. PHP에서 제어는 키 oid 및 문자열 값이 있는 요소와 두 개의 선택적 요소를 포함하는 배열로 제공됩니다. 선택적 요소는 문자열 값이 있는 키 값이고 부울 값이 있는 키 iscritical입니다. iscritical은 제공되지 않은 경우 기본적으로false
로 설정됩니다. 자세한 내용은 » draft-ietf-ldapext-ldap-c-api-xx.txt를 참조하세요. 아래의 두 번째 예도 참조하십시오. value
- 지정된
option
의 새 값입니다.
반환 값
성공하면 true
를, 실패하면 false
를 반환합니다.
변경 로그
버전 | 설명 |
---|---|
8.1.0 | ldap 매개변수는 이제 LDAP\Connection 인스턴스를 예상합니다. 이전에는 리소스가 필요했습니다. |
Examples
예제 #1 Set protocol version
<?php
// $ds is a valid LDAP\Connection instance for a directory server
if (ldap_set_option($ds, LDAP_OPT_PROTOCOL_VERSION, 3)) {
echo "Using LDAPv3";
} else {
echo "Failed to set protocol version to 3";
}
?>
예제 #2 Set server controls
<?php
// $ds is a valid LDAP\Connection instance for a directory server
// control with no value
$ctrl1 = array("oid" => "1.2.752.58.10.1", "iscritical" => true);
// iscritical defaults to FALSE
$ctrl2 = array("oid" => "1.2.752.58.1.10", "value" => "magic");
// try to set both controls
if (!ldap_set_option($ds, LDAP_OPT_SERVER_CONTROLS, array($ctrl1, $ctrl2))) {
echo "Failed to set server controls";
}
?>
메모
참고: 이 함수는 OpenLDAP 2.x.x 또는 Netscape Directory SDK x.x를 사용할 때만 사용할 수 있습니다.
기타
- ldap_get_option() - 주어진 옵션에 대한 현재 값 가져오기