Mô tả
Hàm restore_exception_handler() khôi phục trình xử lý ngoại lệ trước đó. Dùng sau khi thay đổi trình xử lý ngoại lệ bằng set_exception_handler(), để quay lại trình xử lý trước (built-in hoặc do người dùng định nghĩa).
Cú pháp
restore_exception_handler()
Tham số
- NA
Giá trị trả về
Luôn trả về TRUE.
Ví dụ
<?php
function customException1($exception) {
echo "[" . __FUNCTION__ . "]" . $exception->getMessage();
}
function customException2($exception) {
echo "[" . __FUNCTION__ . "]" . $exception->getMessage();
}
function customException3($exception) {
echo "[" . __FUNCTION__ . "]" . $exception->getMessage();
}
set_exception_handler("customException1");
set_exception_handler("customException2");
set_exception_handler("customException3");
restore_exception_handler();
// ném ngoại lệ
throw new Exception("Triggers the first exception handler!");
?>Kết quả
[customException1] Triggers the first exception handler!