mirror of
https://github.com/fofolee/uTools-Manuals.git
synced 2025-06-18 13:57:03 +08:00
332 lines
13 KiB
HTML
332 lines
13 KiB
HTML
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
||
<html>
|
||
<head>
|
||
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
|
||
<title>Set the value of the given option</title>
|
||
</head>
|
||
<body class="docs"><div id="layout">
|
||
<div id="layout-content"><div id="function.ldap-set-option" class="refentry">
|
||
<div class="refnamediv">
|
||
<h1 class="refname">ldap_set_option</h1>
|
||
<p class="verinfo">(PHP 4 >= 4.0.4, PHP 5, PHP 7)</p><p class="refpurpose"><span class="refname">ldap_set_option</span> — <span class="dc-title">Set the value of the given option</span></p>
|
||
|
||
</div>
|
||
|
||
<div class="refsect1 description" id="refsect1-function.ldap-set-option-description">
|
||
<h3 class="title">说明</h3>
|
||
<div class="methodsynopsis dc-description">
|
||
<span class="methodname"><strong>ldap_set_option</strong></span>
|
||
( <span class="methodparam"><span class="type">resource</span> <code class="parameter">$link_identifier</code></span>
|
||
, <span class="methodparam"><span class="type">int</span> <code class="parameter">$option</code></span>
|
||
, <span class="methodparam"><span class="type"><a href="language.pseudo-types.html#language.types.mixed" class="type mixed">mixed</a></span> <code class="parameter">$newval</code></span>
|
||
) : <span class="type">bool</span></div>
|
||
|
||
<p class="para rdfs-comment">
|
||
Sets the value of the specified option to be <code class="parameter">newval</code>.
|
||
</p>
|
||
</div>
|
||
|
||
|
||
<div class="refsect1 parameters" id="refsect1-function.ldap-set-option-parameters">
|
||
<h3 class="title">参数</h3>
|
||
<p class="para">
|
||
<dl>
|
||
|
||
|
||
<dt>
|
||
<code class="parameter">link_identifier</code></dt>
|
||
|
||
<dd>
|
||
|
||
<p class="para">
|
||
An LDAP link identifier, returned by <span class="function"><a href="ldap_connect.html" class="function">ldap_connect()</a></span>.
|
||
</p>
|
||
</dd>
|
||
|
||
|
||
|
||
<dt>
|
||
<code class="parameter">option</code></dt>
|
||
|
||
<dd>
|
||
|
||
<p class="para">
|
||
The parameter <code class="parameter">option</code> can be one of:
|
||
<table class="doctable informaltable">
|
||
|
||
<thead>
|
||
<tr>
|
||
<th>Option</th>
|
||
<th>Type</th>
|
||
<th>Available since</th>
|
||
</tr>
|
||
|
||
</thead>
|
||
|
||
<tbody class="tbody">
|
||
<tr>
|
||
<td><strong><code>LDAP_OPT_DEREF</code></strong></td>
|
||
<td>integer</td>
|
||
<td class="empty"> </td>
|
||
</tr>
|
||
|
||
<tr>
|
||
<td><strong><code>LDAP_OPT_SIZELIMIT</code></strong></td>
|
||
<td>integer</td>
|
||
<td class="empty"> </td>
|
||
</tr>
|
||
|
||
<tr>
|
||
<td><strong><code>LDAP_OPT_TIMELIMIT</code></strong></td>
|
||
<td>integer</td>
|
||
<td class="empty"> </td>
|
||
</tr>
|
||
|
||
<tr>
|
||
<td><strong><code>LDAP_OPT_NETWORK_TIMEOUT</code></strong></td>
|
||
<td>integer</td>
|
||
<td>PHP 5.3.0</td>
|
||
</tr>
|
||
|
||
<tr>
|
||
<td><strong><code>LDAP_OPT_PROTOCOL_VERSION</code></strong></td>
|
||
<td>integer</td>
|
||
<td class="empty"> </td>
|
||
</tr>
|
||
|
||
<tr>
|
||
<td><strong><code>LDAP_OPT_ERROR_NUMBER</code></strong></td>
|
||
<td>integer</td>
|
||
<td class="empty"> </td>
|
||
</tr>
|
||
|
||
<tr>
|
||
<td><strong><code>LDAP_OPT_REFERRALS</code></strong></td>
|
||
<td>bool</td>
|
||
<td class="empty"> </td>
|
||
</tr>
|
||
|
||
<tr>
|
||
<td><strong><code>LDAP_OPT_RESTART</code></strong></td>
|
||
<td>bool</td>
|
||
<td class="empty"> </td>
|
||
</tr>
|
||
|
||
<tr>
|
||
<td><strong><code>LDAP_OPT_HOST_NAME</code></strong></td>
|
||
<td>string</td>
|
||
<td class="empty"> </td>
|
||
</tr>
|
||
|
||
<tr>
|
||
<td><strong><code>LDAP_OPT_ERROR_STRING</code></strong></td>
|
||
<td>string</td>
|
||
<td class="empty"> </td>
|
||
</tr>
|
||
|
||
<tr>
|
||
<td><strong><code>LDAP_OPT_DIAGNOSTIC_MESSAGE</code></strong></td>
|
||
<td>string</td>
|
||
<td class="empty"> </td>
|
||
</tr>
|
||
|
||
<tr>
|
||
<td><strong><code>LDAP_OPT_MATCHED_DN</code></strong></td>
|
||
<td>string</td>
|
||
<td class="empty"> </td>
|
||
</tr>
|
||
|
||
<tr>
|
||
<td><strong><code>LDAP_OPT_SERVER_CONTROLS</code></strong></td>
|
||
<td>array</td>
|
||
<td class="empty"> </td>
|
||
</tr>
|
||
|
||
<tr>
|
||
<td><strong><code>LDAP_OPT_CLIENT_CONTROLS</code></strong></td>
|
||
<td>array</td>
|
||
<td class="empty"> </td>
|
||
</tr>
|
||
|
||
<tr>
|
||
<td><strong><code>LDAP_OPT_X_KEEPALIVE_IDLE</code></strong></td>
|
||
<td>int</td>
|
||
<td>PHP 7.1.0</td>
|
||
</tr>
|
||
|
||
<tr>
|
||
<td><strong><code>LDAP_OPT_X_KEEPALIVE_PROBES</code></strong></td>
|
||
<td>int</td>
|
||
<td>PHP 7.1.0</td>
|
||
</tr>
|
||
|
||
<tr>
|
||
<td><strong><code>LDAP_OPT_X_KEEPALIVE_INTERVAL</code></strong></td>
|
||
<td>int</td>
|
||
<td>PHP 7.1.0</td>
|
||
</tr>
|
||
|
||
<tr>
|
||
<td><strong><code>LDAP_OPT_X_TLS_CACERTDIR</code></strong></td>
|
||
<td>string</td>
|
||
<td>PHP 7.1.0</td>
|
||
</tr>
|
||
|
||
<tr>
|
||
<td><strong><code>LDAP_OPT_X_TLS_CACERTFILE</code></strong></td>
|
||
<td>string</td>
|
||
<td>PHP 7.1.0</td>
|
||
</tr>
|
||
|
||
<tr>
|
||
<td><strong><code>LDAP_OPT_X_TLS_CERTFILE</code></strong></td>
|
||
<td>string</td>
|
||
<td>PHP 7.1.0</td>
|
||
</tr>
|
||
|
||
<tr>
|
||
<td><strong><code>LDAP_OPT_X_TLS_CIPHER_SUITE</code></strong></td>
|
||
<td>string</td>
|
||
<td>PHP 7.1.0</td>
|
||
</tr>
|
||
|
||
<tr>
|
||
<td><strong><code>LDAP_OPT_X_TLS_CRLCHECK</code></strong></td>
|
||
<td>integer</td>
|
||
<td>PHP 7.1.0</td>
|
||
</tr>
|
||
|
||
<tr>
|
||
<td><strong><code>LDAP_OPT_X_TLS_CRLFILE</code></strong></td>
|
||
<td>string</td>
|
||
<td>PHP 7.1.0</td>
|
||
</tr>
|
||
|
||
<tr>
|
||
<td><strong><code>LDAP_OPT_X_TLS_DHFILE</code></strong></td>
|
||
<td>string</td>
|
||
<td>PHP 7.1.0</td>
|
||
</tr>
|
||
|
||
<tr>
|
||
<td><strong><code>LDAP_OPT_X_TLS_KEYFILE</code></strong></td>
|
||
<td>string</td>
|
||
<td>PHP 7.1.0</td>
|
||
</tr>
|
||
|
||
<tr>
|
||
<td><strong><code>LDAP_OPT_X_TLS_PROTOCOL_MIN</code></strong></td>
|
||
<td>integer</td>
|
||
<td>PHP 7.1.0</td>
|
||
</tr>
|
||
|
||
<tr>
|
||
<td><strong><code>LDAP_OPT_X_TLS_RANDOM_FILE</code></strong></td>
|
||
<td>string</td>
|
||
<td>PHP 7.1.0</td>
|
||
</tr>
|
||
|
||
<tr>
|
||
<td><strong><code>LDAP_OPT_X_TLS_REQUIRE_CERT</code></strong></td>
|
||
<td>integer</td>
|
||
<td>PHP 7.0.5</td>
|
||
</tr>
|
||
|
||
</tbody>
|
||
|
||
</table>
|
||
|
||
</p>
|
||
<p class="para">
|
||
<strong><code>LDAP_OPT_SERVER_CONTROLS</code></strong> and
|
||
<strong><code>LDAP_OPT_CLIENT_CONTROLS</code></strong> require a list of
|
||
controls, this means that the value must be an array of controls. A
|
||
control consists of an <em class="emphasis">oid</em> identifying the control,
|
||
an optional <em class="emphasis">value</em>, and an optional flag for
|
||
<em class="emphasis">criticality</em>. In PHP a control is given by an
|
||
array containing an element with the key <em class="emphasis">oid</em>
|
||
and string value, and two optional elements. The optional
|
||
elements are key <em class="emphasis">value</em> with string value
|
||
and key <em class="emphasis">iscritical</em> with boolean value.
|
||
<em class="emphasis">iscritical</em> defaults to <em class="emphasis"><strong><code>FALSE</code></strong></em>
|
||
if not supplied. See <a href="http://www.openldap.org/devel/cvsweb.cgi/~checkout~/doc/drafts/draft-ietf-ldapext-ldap-c-api-xx.txt" class="link external">» draft-ietf-ldapext-ldap-c-api-xx.txt</a>
|
||
for details. See also the second example below.
|
||
</p>
|
||
</dd>
|
||
|
||
|
||
|
||
<dt>
|
||
<code class="parameter">newval</code></dt>
|
||
|
||
<dd>
|
||
|
||
<p class="para">
|
||
The new value for the specified <code class="parameter">option</code>.
|
||
</p>
|
||
</dd>
|
||
|
||
|
||
</dl>
|
||
|
||
</p>
|
||
</div>
|
||
|
||
|
||
<div class="refsect1 returnvalues" id="refsect1-function.ldap-set-option-returnvalues">
|
||
<h3 class="title">返回值</h3>
|
||
<p class="para">
|
||
成功时返回 <strong><code>TRUE</code></strong>, 或者在失败时返回 <strong><code>FALSE</code></strong>。
|
||
</p>
|
||
</div>
|
||
|
||
|
||
<div class="refsect1 examples" id="refsect1-function.ldap-set-option-examples">
|
||
<h3 class="title">范例</h3>
|
||
<p class="para">
|
||
<div class="example" id="example-5410">
|
||
<p><strong>Example #1 Set protocol version</strong></p>
|
||
<div class="example-contents">
|
||
<div class="phpcode"><pre><span style="color: #000000">
|
||
<span style="color: #0000BB"><?php<br /></span><span style="color: #FF8000">// $ds is a valid link identifier for a directory server<br /></span><span style="color: #007700">if (</span><span style="color: #0000BB">ldap_set_option</span><span style="color: #007700">(</span><span style="color: #0000BB">$ds</span><span style="color: #007700">, </span><span style="color: #0000BB">LDAP_OPT_PROTOCOL_VERSION</span><span style="color: #007700">, </span><span style="color: #0000BB">3</span><span style="color: #007700">)) {<br /> echo </span><span style="color: #DD0000">"Using LDAPv3"</span><span style="color: #007700">;<br />} else {<br /> echo </span><span style="color: #DD0000">"Failed to set protocol version to 3"</span><span style="color: #007700">;<br />}<br /></span><span style="color: #0000BB">?></span>
|
||
</span>
|
||
</pre></div>
|
||
</div>
|
||
|
||
</div>
|
||
<div class="example" id="example-5411">
|
||
<p><strong>Example #2 Set server controls</strong></p>
|
||
<div class="example-contents">
|
||
<div class="phpcode"><pre><span style="color: #000000">
|
||
<span style="color: #0000BB"><?php<br /></span><span style="color: #FF8000">// $ds is a valid link identifier for a directory server<br />// control with no value<br /></span><span style="color: #0000BB">$ctrl1 </span><span style="color: #007700">= array(</span><span style="color: #DD0000">"oid" </span><span style="color: #007700">=> </span><span style="color: #DD0000">"1.2.752.58.10.1"</span><span style="color: #007700">, </span><span style="color: #DD0000">"iscritical" </span><span style="color: #007700">=> </span><span style="color: #0000BB">true</span><span style="color: #007700">);<br /></span><span style="color: #FF8000">// iscritical defaults to FALSE<br /></span><span style="color: #0000BB">$ctrl2 </span><span style="color: #007700">= array(</span><span style="color: #DD0000">"oid" </span><span style="color: #007700">=> </span><span style="color: #DD0000">"1.2.752.58.1.10"</span><span style="color: #007700">, </span><span style="color: #DD0000">"value" </span><span style="color: #007700">=> </span><span style="color: #DD0000">"magic"</span><span style="color: #007700">);<br /></span><span style="color: #FF8000">// try to set both controls<br /></span><span style="color: #007700">if (!</span><span style="color: #0000BB">ldap_set_option</span><span style="color: #007700">(</span><span style="color: #0000BB">$ds</span><span style="color: #007700">, </span><span style="color: #0000BB">LDAP_OPT_SERVER_CONTROLS</span><span style="color: #007700">, array(</span><span style="color: #0000BB">$ctrl1</span><span style="color: #007700">, </span><span style="color: #0000BB">$ctrl2</span><span style="color: #007700">))) {<br /> echo </span><span style="color: #DD0000">"Failed to set server controls"</span><span style="color: #007700">;<br />}<br /></span><span style="color: #0000BB">?></span>
|
||
</span>
|
||
</pre></div>
|
||
</div>
|
||
|
||
</div>
|
||
</p>
|
||
</div>
|
||
|
||
|
||
<div class="refsect1 notes" id="refsect1-function.ldap-set-option-notes">
|
||
<h3 class="title">注释</h3>
|
||
<blockquote class="note"><p><strong class="note">Note</strong>:
|
||
<p class="para">
|
||
This function is only available when using OpenLDAP 2.x.x OR Netscape
|
||
Directory SDK x.x.
|
||
</p>
|
||
</p></blockquote>
|
||
</div>
|
||
|
||
|
||
<div class="refsect1 seealso" id="refsect1-function.ldap-set-option-seealso">
|
||
<h3 class="title">参见</h3>
|
||
<p class="para">
|
||
<ul class="simplelist">
|
||
<li class="member"><span class="function"><a href="ldap_get_option.html" class="function" rel="rdfs-seeAlso">ldap_get_option()</a> - Get the current value for given option</span></li>
|
||
</ul>
|
||
</p>
|
||
</div>
|
||
|
||
|
||
</div></div></div></body></html> |