나는 도약을하고 있습니다 : 내 PHP 스크립트는 모두 정상적으로 실패합니다! set_error_handler 작동하지 않습니다 어떻게 작동하고 싶습니다
는 적어도, 그것은 내가 (실질적으로) 시도 ... catch 문마다 한 줄을 포장하고 싶지 않아위한 ...바라고 무엇을, 그래서 난 내 최선을 내기가 생각 내 파일의 시작 부분에 대한 사용자 정의 오류 처리기를 만듭니다.
것은 내가 연습 페이지에 그것을 테스트하고있어이 잘, 반환 작품
function customError($level,$message,$file,$line,$context) {
echo "Sorry, an error has occured on line $line.<br />";
echo "The function that caused the error says $message.<br />";
die();
}
set_error_handler("customError");
echo($imAFakeVariable);
:
Sorry, an error has occured on line 17. The function that caused the error says Undefined variable: imAFakeVariable.
그러나,이 설정은 정의되지 않은 기능이 작동하지 않습니다.
function customError($level,$message,$file,$line,$context) {
echo "Sorry, an error has occured on line $line.<br />";
echo "The function that caused the error says $message.<br />";
die();
}
set_error_handler("customError");
imAFakeFunction();
이 반환
Fatal error: Call to undefined function: imafakefunction() in /Library/WebServer/Documents/experimental/errorhandle.php on line 17
왜 내 사용자 지정 오류 처리기가 정의되지 않은 기능을 잡기되지 않는 이유는 무엇입니까? 이로 인해 발생할 수있는 다른 문제가 있습니까?