サイトの実行中に発生するすべての PHP エラーをキャプチャし、それらを変数に保存し、それらを JavaScript セクションに出力して印刷することは可能ですか?
すなわち
サイトの実行中に発生するすべての PHP エラーをキャプチャし、それらを変数に保存し、それらを JavaScript セクションに出力して印刷することは可能ですか?
すなわち
それがset_error_handler
目的です..実際の例と完全なドキュメントを参照してください
http://php.net/manual/en/function.set-error-handler.php
あなたも見るべきですset_exception_handler
http://php.net/manual/en/function.set-exception-handler.php
例
set_error_handler('my_error_handler');
set_exception_handler('my_exception_handler');
function my_exception_handler($e) {
exit('Huston! We have a problem: '.$e);
}
function my_error_handler($no,$str,$file,$line) {
$e = new ErrorException($str,$no,0,$file,$line);
my_exception_handler($e); /* Do not throw, simply call error handler with exception object */
}