mirror of
https://github.com/fofolee/uTools-Manuals.git
synced 2025-06-18 05:26:57 +08:00
93 lines
6.2 KiB
HTML
93 lines
6.2 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>Return the LDAP error number of the last LDAP command</title>
|
|
</head>
|
|
<body class="docs"><div id="layout">
|
|
<div id="layout-content"><div id="function.ldap-errno" class="refentry">
|
|
<div class="refnamediv">
|
|
<h1 class="refname">ldap_errno</h1>
|
|
<p class="verinfo">(PHP 4, PHP 5, PHP 7)</p><p class="refpurpose"><span class="refname">ldap_errno</span> — <span class="dc-title">Return the LDAP error number of the last LDAP command</span></p>
|
|
|
|
</div>
|
|
|
|
<div class="refsect1 description" id="refsect1-function.ldap-errno-description">
|
|
<h3 class="title">说明</h3>
|
|
<div class="methodsynopsis dc-description">
|
|
<span class="methodname"><strong>ldap_errno</strong></span>
|
|
( <span class="methodparam"><span class="type">resource</span> <code class="parameter">$link_identifier</code></span>
|
|
) : <span class="type">int</span></div>
|
|
|
|
<p class="para rdfs-comment">
|
|
Returns the standardized error number returned by the last LDAP command.
|
|
This number can be converted into a textual error message using
|
|
<span class="function"><a href="ldap_err2str.html" class="function">ldap_err2str()</a></span>.
|
|
</p>
|
|
</div>
|
|
|
|
|
|
<div class="refsect1 parameters" id="refsect1-function.ldap-errno-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>
|
|
|
|
|
|
</dl>
|
|
|
|
</p>
|
|
</div>
|
|
|
|
|
|
<div class="refsect1 returnvalues" id="refsect1-function.ldap-errno-returnvalues">
|
|
<h3 class="title">返回值</h3>
|
|
<p class="para">
|
|
Return the LDAP error number of the last LDAP command for this
|
|
link.
|
|
</p>
|
|
</div>
|
|
|
|
|
|
<div class="refsect1 examples" id="refsect1-function.ldap-errno-examples">
|
|
<h3 class="title">范例</h3>
|
|
<p class="para">
|
|
Unless you lower your warning level in your <var class="filename">php.ini</var> sufficiently or
|
|
prefix your LDAP commands with @ (at) characters to suppress warning
|
|
output, the errors generated will also show up in your HTML output.
|
|
<div class="example" id="example-5395">
|
|
<p><strong>Example #1 Generating and catching an error</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">// This example contains an error, which we will catch.<br /></span><span style="color: #0000BB">$ld </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">);<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">$ld</span><span style="color: #007700">);<br /></span><span style="color: #FF8000">// syntax error in filter expression (errno 87),<br />// must be "objectclass=*" to work.<br /></span><span style="color: #0000BB">$res </span><span style="color: #007700">= @</span><span style="color: #0000BB">ldap_search</span><span style="color: #007700">(</span><span style="color: #0000BB">$ld</span><span style="color: #007700">, </span><span style="color: #DD0000">"o=Myorg, c=DE"</span><span style="color: #007700">, </span><span style="color: #DD0000">"objectclass"</span><span style="color: #007700">);<br />if (!</span><span style="color: #0000BB">$res</span><span style="color: #007700">) {<br /> echo </span><span style="color: #DD0000">"LDAP-Errno: " </span><span style="color: #007700">. </span><span style="color: #0000BB">ldap_errno</span><span style="color: #007700">(</span><span style="color: #0000BB">$ld</span><span style="color: #007700">) . </span><span style="color: #DD0000">"<br />\n"</span><span style="color: #007700">;<br /> echo </span><span style="color: #DD0000">"LDAP-Error: " </span><span style="color: #007700">. </span><span style="color: #0000BB">ldap_error</span><span style="color: #007700">(</span><span style="color: #0000BB">$ld</span><span style="color: #007700">) . </span><span style="color: #DD0000">"<br />\n"</span><span style="color: #007700">;<br /> die(</span><span style="color: #DD0000">"Argh!<br />\n"</span><span style="color: #007700">);<br />}<br /></span><span style="color: #0000BB">$info </span><span style="color: #007700">= </span><span style="color: #0000BB">ldap_get_entries</span><span style="color: #007700">(</span><span style="color: #0000BB">$ld</span><span style="color: #007700">, </span><span style="color: #0000BB">$res</span><span style="color: #007700">);<br />echo </span><span style="color: #0000BB">$info</span><span style="color: #007700">[</span><span style="color: #DD0000">"count"</span><span style="color: #007700">] . </span><span style="color: #DD0000">" matching entries.<br />\n"</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">?></span>
|
|
</span>
|
|
</pre></div>
|
|
</div>
|
|
|
|
</div>
|
|
</p>
|
|
</div>
|
|
|
|
|
|
<div class="refsect1 seealso" id="refsect1-function.ldap-errno-seealso">
|
|
<h3 class="title">参见</h3>
|
|
<p class="para">
|
|
<ul class="simplelist">
|
|
<li class="member"><span class="function"><a href="ldap_err2str.html" class="function" rel="rdfs-seeAlso">ldap_err2str()</a> - Convert LDAP error number into string error message</span></li>
|
|
<li class="member"><span class="function"><a href="ldap_error.html" class="function" rel="rdfs-seeAlso">ldap_error()</a> - Return the LDAP error message of the last LDAP command</span></li>
|
|
</ul>
|
|
</p>
|
|
</div>
|
|
|
|
|
|
</div></div></div></body></html> |