ldap_errno

(PHP 4, PHP 5, PHP 7, PHP 8)

ldap_errnoReturn the LDAP error number of the last LDAP command

Açıklama

ldap_errno(LDAP\Connection$ldap): int

Returns the standardized error number returned by the last LDAP command. This number can be converted into a textual error message using ldap_err2str().

Bağımsız Değişkenler

ldap

ldap_list() veya ldap_connect() işlevinden dönen LDAP\Connection nesnesi.

Dönen Değerler

Return the LDAP error number of the last LDAP command for this link.

Sürüm Bilgisi

Sürüm: Açıklama
8.1.0ldap bağımsız değişkeni artık LDAP\Connection nesnesi kabul ediyor, evvelce resource türünde geçerli bir ldap link değeri kabul ederdi.

Örnekler

Unless you lower your warning level in your php.ini sufficiently or prefix your LDAP commands with @ (at) characters to suppress warning output, the errors generated will also show up in your HTML output.

Örnek 1 Generating and catching an error

<?php
// This example contains an error, which we will catch.
$ld = ldap_connect("localhost");
$bind = ldap_bind($ld);
// syntax error in filter expression (errno 87),
// must be "objectclass=*" to work.
$res = @ldap_search($ld, "o=Myorg, c=DE", "objectclass");
if (!
$res) {
echo
"LDAP-Errno: " . ldap_errno($ld) . "<br />\n";
echo
"LDAP-Error: " . ldap_error($ld) . "<br />\n";
die(
"Argh!<br />\n");
}
$info = ldap_get_entries($ld, $res);
echo
$info["count"] . " matching entries.<br />\n";
?>

Ayrıca Bakınız

  • ldap_err2str() - Convert LDAP error number into string error message
  • ldap_error() - Return the LDAP error message of the last LDAP command
To Top