mirror of
https://github.com/fofolee/uTools-Manuals.git
synced 2025-06-18 05:26:57 +08:00
188 lines
11 KiB
HTML
188 lines
11 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>Performs an extended operation</title>
|
|
</head>
|
|
<body class="docs"><div id="layout">
|
|
<div id="layout-content"><div id="function.ldap-exop" class="refentry">
|
|
<div class="refnamediv">
|
|
<h1 class="refname">ldap_exop</h1>
|
|
<p class="verinfo">(PHP 7 >= 7.2.0)</p><p class="refpurpose"><span class="refname">ldap_exop</span> — <span class="dc-title">Performs an extended operation</span></p>
|
|
|
|
</div>
|
|
|
|
<div class="refsect1 description" id="refsect1-function.ldap-exop-description">
|
|
<h3 class="title">说明</h3>
|
|
<div class="methodsynopsis dc-description">
|
|
<span class="methodname"><strong>ldap_exop</strong></span>
|
|
( <span class="methodparam"><span class="type">resource</span> <code class="parameter">$link</code></span>
|
|
, <span class="methodparam"><span class="type">string</span> <code class="parameter">$reqoid</code></span>
|
|
[, <span class="methodparam"><span class="type">string</span> <code class="parameter">$reqdata</code><span class="initializer"> = <strong><code>NULL</code></strong></span></span>
|
|
[, <span class="methodparam"><span class="type">array</span> <code class="parameter">$serverctrls</code><span class="initializer"> = <strong><code>NULL</code></strong></span></span>
|
|
[, <span class="methodparam"><span class="type">string</span> <code class="parameter reference">&$retdata</code></span>
|
|
[, <span class="methodparam"><span class="type">string</span> <code class="parameter reference">&$retoid</code></span>
|
|
]]]] ) : <span class="type"><a href="language.pseudo-types.html#language.types.mixed" class="type mixed">mixed</a></span></div>
|
|
|
|
<p class="para rdfs-comment">
|
|
Performs an extended operation on the specified <code class="parameter">link</code> with
|
|
<code class="parameter">reqoid</code> the OID of the operation and
|
|
<code class="parameter">reqdata</code> the data.
|
|
</p>
|
|
</div>
|
|
|
|
|
|
<div class="refsect1 parameters" id="refsect1-function.ldap-exop-parameters">
|
|
<h3 class="title">参数</h3>
|
|
<dl>
|
|
|
|
|
|
<dt>
|
|
<code class="parameter">link</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">reqoid</code></dt>
|
|
|
|
<dd>
|
|
|
|
<p class="para">
|
|
The extended operation request OID. You may use one of <strong><code>LDAP_EXOP_START_TLS</code></strong>, <strong><code>LDAP_EXOP_MODIFY_PASSWD</code></strong>, <strong><code>LDAP_EXOP_REFRESH</code></strong>, <strong><code>LDAP_EXOP_WHO_AM_I</code></strong>, <strong><code>LDAP_EXOP_TURN</code></strong>, or a string with the OID of the operation you want to send.
|
|
</p>
|
|
</dd>
|
|
|
|
|
|
|
|
<dt>
|
|
<code class="parameter">reqdata</code></dt>
|
|
|
|
<dd>
|
|
|
|
<p class="para">
|
|
The extended operation request data. May be NULL for some operations like <strong><code>LDAP_EXOP_WHO_AM_I</code></strong>, may also need to be BER encoded.
|
|
</p>
|
|
</dd>
|
|
|
|
|
|
|
|
<dt>
|
|
<code class="parameter">serverctrls</code></dt>
|
|
|
|
<dd>
|
|
|
|
<p class="para">
|
|
Array of <a href="ldap.controls.html" class="link">LDAP Controls</a> to send with the request.
|
|
</p>
|
|
</dd>
|
|
|
|
|
|
|
|
<dt>
|
|
<code class="parameter">retdata</code></dt>
|
|
|
|
<dd>
|
|
|
|
<p class="para">
|
|
Will be filled with the extended operation response data if provided.
|
|
If not provided you may use ldap_parse_exop on the result object
|
|
later to get this data.
|
|
</p>
|
|
</dd>
|
|
|
|
|
|
|
|
<dt>
|
|
<code class="parameter">retoid</code></dt>
|
|
|
|
<dd>
|
|
|
|
<p class="para">
|
|
Will be filled with the response OID if provided, usually equal to the request OID.
|
|
</p>
|
|
</dd>
|
|
|
|
|
|
</dl>
|
|
|
|
</div>
|
|
|
|
|
|
<div class="refsect1 returnvalues" id="refsect1-function.ldap-exop-returnvalues">
|
|
<h3 class="title">返回值</h3>
|
|
<p class="para">
|
|
When used with <code class="parameter">retdata</code>, returns <strong><code>TRUE</code></strong> on success or <strong><code>FALSE</code></strong> on error.
|
|
When used without <code class="parameter">retdata</code>, returns a result identifier or <strong><code>FALSE</code></strong> on error.
|
|
</p>
|
|
</div>
|
|
|
|
|
|
<div class="refsect1 changelog" id="refsect1-function.ldap-exop-changelog">
|
|
<h3 class="title">更新日志</h3>
|
|
<p class="para">
|
|
<table class="doctable informaltable">
|
|
|
|
<thead>
|
|
<tr>
|
|
<th>版本</th>
|
|
<th>说明</th>
|
|
</tr>
|
|
|
|
</thead>
|
|
|
|
<tbody class="tbody">
|
|
<tr>
|
|
<td>7.3</td>
|
|
<td>
|
|
Support for <code class="parameter">serverctrls</code> added
|
|
</td>
|
|
</tr>
|
|
|
|
</tbody>
|
|
|
|
</table>
|
|
|
|
</p>
|
|
</div>
|
|
|
|
|
|
<div class="refsect1 examples" id="refsect1-function.ldap-exop-examples">
|
|
<h3 class="title">范例</h3>
|
|
<p class="para">
|
|
<div class="example" id="example-5398">
|
|
<p><strong>Example #1 Whoami extended operation</strong></p>
|
|
<div class="example-contents">
|
|
<div class="phpcode"><pre><span style="color: #000000">
|
|
<span style="color: #0000BB"><?php<br />$ds </span><span style="color: #007700">= </span><span style="color: #0000BB">ldap_connect</span><span style="color: #007700">(</span><span style="color: #DD0000">"localhost"</span><span style="color: #007700">); </span><span style="color: #FF8000">// assuming the LDAP server is on this host<br /><br /></span><span style="color: #007700">if (</span><span style="color: #0000BB">$ds</span><span style="color: #007700">) {<br /> </span><span style="color: #FF8000">// bind with appropriate dn to give update access<br /> </span><span style="color: #0000BB">$bind </span><span style="color: #007700">= </span><span style="color: #0000BB">ldap_bind</span><span style="color: #007700">(</span><span style="color: #0000BB">$ds</span><span style="color: #007700">, </span><span style="color: #DD0000">"cn=root, o=My Company, c=US"</span><span style="color: #007700">, </span><span style="color: #DD0000">"secret"</span><span style="color: #007700">);<br /> if (!</span><span style="color: #0000BB">$bind</span><span style="color: #007700">) {<br /> echo </span><span style="color: #DD0000">"Unable to bind to LDAP server"</span><span style="color: #007700">;<br /> exit;<br /> }<br /><br /> </span><span style="color: #FF8000">// Call WHOAMI EXOP<br /> </span><span style="color: #0000BB">$r </span><span style="color: #007700">= </span><span style="color: #0000BB">ldap_exop</span><span style="color: #007700">(</span><span style="color: #0000BB">$ds</span><span style="color: #007700">, </span><span style="color: #0000BB">LDAP_EXOP_WHO_AM_I</span><span style="color: #007700">);<br /><br /> </span><span style="color: #FF8000">// Parse the result object<br /> </span><span style="color: #0000BB">ldap_parse_exop</span><span style="color: #007700">(</span><span style="color: #0000BB">$ds</span><span style="color: #007700">, </span><span style="color: #0000BB">$r</span><span style="color: #007700">, </span><span style="color: #0000BB">$retdata</span><span style="color: #007700">);<br /> </span><span style="color: #FF8000">// Output: string(31) "dn:cn=root, o=My Company, c=US"<br /> </span><span style="color: #0000BB">var_dump</span><span style="color: #007700">(</span><span style="color: #0000BB">$retdata</span><span style="color: #007700">);<br /><br /> </span><span style="color: #FF8000">// Same thing using $retdata parameter<br /> </span><span style="color: #0000BB">$success </span><span style="color: #007700">= </span><span style="color: #0000BB">ldap_exop</span><span style="color: #007700">(</span><span style="color: #0000BB">$ds</span><span style="color: #007700">, </span><span style="color: #0000BB">LDAP_EXOP_WHO_AM_I</span><span style="color: #007700">, </span><span style="color: #0000BB">NULL</span><span style="color: #007700">, </span><span style="color: #0000BB">NULL</span><span style="color: #007700">, </span><span style="color: #0000BB">$retdata</span><span style="color: #007700">, </span><span style="color: #0000BB">$retoid</span><span style="color: #007700">);<br /> if (</span><span style="color: #0000BB">$success</span><span style="color: #007700">) {<br /> </span><span style="color: #0000BB">var_dump</span><span style="color: #007700">(</span><span style="color: #0000BB">$retdata</span><span style="color: #007700">);<br /> }<br /><br /> </span><span style="color: #0000BB">ldap_close</span><span style="color: #007700">(</span><span style="color: #0000BB">$ds</span><span style="color: #007700">);<br />} else {<br /> echo </span><span style="color: #DD0000">"Unable to connect to LDAP server"</span><span style="color: #007700">;<br />}<br /></span><span style="color: #0000BB">?></span>
|
|
</span>
|
|
</pre></div>
|
|
</div>
|
|
|
|
</div>
|
|
</p>
|
|
</div>
|
|
|
|
|
|
<div class="refsect1 seealso" id="refsect1-function.ldap-exop-seealso">
|
|
<h3 class="title">参见</h3>
|
|
<p class="para">
|
|
<ul class="simplelist">
|
|
<li class="member"><span class="function"><a href="ldap_parse_result.html" class="function" rel="rdfs-seeAlso">ldap_parse_result()</a> - Extract information from result</span></li>
|
|
<li class="member"><span class="function"><a href="ldap_parse_exop.html" class="function" rel="rdfs-seeAlso">ldap_parse_exop()</a> - Parse result object from an LDAP extended operation</span></li>
|
|
<li class="member"><span class="function"><a href="ldap_exop_whoami.html" class="function" rel="rdfs-seeAlso">ldap_exop_whoami()</a> - WHOAMI extended operation helper</span></li>
|
|
<li class="member"><span class="function"><a href="ldap_exop_refresh.html" class="function" rel="rdfs-seeAlso">ldap_exop_refresh()</a> - Refresh extended operation helper</span></li>
|
|
<li class="member"><span class="function"><a href="ldap_exop_passwd.html" class="function" rel="rdfs-seeAlso">ldap_exop_passwd()</a> - PASSWD extended operation helper</span></li>
|
|
</ul>
|
|
</p>
|
|
</div>
|
|
|
|
|
|
|
|
</div></div></div></body></html> |