array ( 0 => 'index.php', 1 => 'PHP Manual', ), 'head' => array ( 0 => 'UTF-8', 1 => 'tr', ), 'this' => array ( 0 => 'yar-server-exception.gettype.php', 1 => 'Yar_Server_Exception::getType', ), 'up' => array ( 0 => 'class.yar-server-exception.php', 1 => 'Yar_Server_Exception', ), 'prev' => array ( 0 => 'class.yar-server-exception.php', 1 => 'Yar_Server_Exception', ), 'next' => array ( 0 => 'class.yar-client-exception.php', 1 => 'Yar_Client_Exception', ), 'alternatives' => array ( ), 'source' => array ( 'lang' => 'en', 'path' => 'reference/yar/yar_server_exception/gettype.xml', ), ); $setup["toc"] = $TOC; $setup["toc_deprecated"] = $TOC_DEPRECATED; $setup["parents"] = $PARENTS; manual_setup($setup); ?>
(PECL yar >= 1.0.0)
Yar_Server_Exception::getType — Retrieve exception's type
Get the exception original type threw by server
Bu işlevin bağımsız değişkeni yoktur.
string
Örnek 1 Yar_Server_Exception::getType() example
//Server.php
<?php
class Custom_Exception extends Exception {};
class API {
public function throw_exception($name) {
throw new Custom_Exception($name);
}
}
$service = new Yar_Server(new API());
$service->handle();
?>
//Client.php
<?php
$client = new Yar_Client("http://host/api.php");
try {
$client->throw_exception("client");
} catch (Yar_Server_Exception $e) {
var_dump($e->getType());
var_dump($e->getMessage());
}
Yukarıdaki örnek şuna benzer bir çıktı üretir:
string(16) "Custom_Exception" string(6) "client"