restore_exception_handler: 以前の例外ハンドラ関数を回復する (エラー処理関数) - PHPプロ!マニュアル

PHPマニュアル

restore_exception_handler: 以前の例外ハンドラ関数を回復する

restore_exception_handler

(PHP 5)

restore_exception_handler以前の例外ハンドラ関数を回復する

説明

bool restore_exception_handler ( void )

set_exception_handler() を使用して例外ハンドラ関数を 変更した後、元の例外ハンドラ(組込またはユーザ定義関数)に戻すために 使用されます。

返り値

この関数は常に TRUE を返します。

例1 restore_exception_handler() の例

<?php
    
function exception_handler_1(Exception $e)
    {
        echo 
'[' __FUNCTION__ '] ' $e->getMessage();
    }

    function 
exception_handler_2(Exception $e)
    {
        echo 
'[' __FUNCTION__ '] ' $e->getMessage();
    }

    
set_exception_handler('exception_handler_1');
    
set_exception_handler('exception_handler_2');

    
restore_exception_handler();

    throw new 
Exception('This triggers the first exception handler...');
?>

上の例の出力は以下となります。

[exception_handler_1] This triggers the first exception handler...

参考


PHPマニュアル



Pick Up Q&A

Q
負荷時のmysql_connect()エラー
 このエントリーをはてなブックマークに追加 
A
これはPHPというよりOSまたはMySQLのコミュニティで質問されたほうがいいと思います。 ぱっと思いついた範囲で記すと MySQL等のDBに「ある時点において同時に接続可能なクライアントの最大数」に制限があるよう...

>>続きを読む

今回のような実践的な経験がエンジニアのキャリアに繋がると思います。是非サービスを成功させて下さい!

▲解説者:岡本(アシアル株式会社 教育コーディネーター兼 システムエンジニア)