EN49

Page 429

if (null === $error || E_ERROR != $error['type']) { return; } // Log last error to a log file. // let's naively assume that logs are in the folder inside the app folder. $logFile = fopen("./app/logs/error.log", "a+"); // Get useful info out of error. $type = $error["type"]; $file = $error["file"]; $line = $error["line"]; $message = $error["message"] fprintf( $logFile, "[%s] %s: %s in %s:%d\n", date("Y-m-d H:i:s"), $type, $message, $file, $line); fclose($logFile); }

register_shutdown_function('fatalErrorHandler');

Reference: http://php.net/manual/en/function.register-shutdown-function.php http://php.net/manual/en/function.error-get-last.php http://php.net/manual/en/errorfunc.constants.php

GoalKicker.com – PHP Notes for Professionals

416


Issuu converts static files into: digital portfolios, online yearbooks, online catalogs, digital photo albums and more. Sign up and create your flipbook.