= 1.5)gnupg_geterrorinfo — Returns the error info說明gnupg_geterrorinfo(resource $identifier): array參數(shù)identifiergnupg 標(biāo)識符">

gnupg_geterrorinfo

(PECL gnupg >= 1.5)

gnupg_geterrorinfoReturns the error info

說明

gnupg_geterrorinfo(resource $identifier): array

參數(shù)

identifier

gnupg 標(biāo)識符,由對 gnupg_init()gnupg 的調(diào)用生成。

返回值

Returns an array with error info.

范例

示例 #1 Procedural gnupg_geterrorinfo() example

<?php
$res 
gnupg_init();
// this is called without any error
print_r(gnupg_geterrorinfo($res));
?>

以上例程會輸出:

array(4) {
  ["generic_message"]=>
  bool(false)
  ["gpgme_code"]=>
  int(0)
  ["gpgme_source"]=>
  string(18) "Unspecified source"
  ["gpgme_message"]=>
  string(7) "Success"
}

示例 #2 OO gnupg_geterrorinfo() example

<?php
$gpg 
= new gnupg();
// error call
$gpg->decrypt('abc');
// error info should be displayed
print_r($gpg->geterrorinfo());
?>

以上例程會輸出:

array(4) {
  ["generic_message"]=>
  string(14) "decrypt failed"
  ["gpgme_code"]=>
  int(117440570)
  ["gpgme_source"]=>
  string(5) "GPGME"
  ["gpgme_message"]=>
  string(7) "No data"
}