Php/カスタムexception
提供: 初心者エンジニアの簡易メモ
2015年5月20日 (水) 03:10時点における127.0.0.1 (トーク)による版 (ページの作成:「==サンプル== function exception_handler($exception) { echo "Uncaught exception: " , $exception->getMessage(), "\n"; mail( "hoge@example.com", $except...」)
サンプル
function exception_handler($exception) {
echo "Uncaught exception: " , $exception->getMessage(), "\n";
mail(
"hoge@example.com",
$exception->getMessage(),
$exception->__toString()
);
}
set_exception_handler('exception_handler');
throw new Exception('Uncaught Exception');
echo "Not Executed\n";
