Co robimy: tworzymy plik logs.txt w katalogu głównym i nadajemy mu chmod 777.
<?php class Error { /** * konstruktor * @param string $msg tresc bledu * @param string $file plik z bledem * @param string $line linia z bledem */ public function __construct($msg, $file, $line) { $this -> add2log($msg); $this -> showSource($file, $line, $prev = 0, $next = 0); } /** * Metoda dodaje informacje o bledzie do logow * @param string $text tresc bledu */ public function add2log($text) { $text = \"n\".date('H:i d.m.Y').\" - \". $text; } /** * pobiera logi z pliku * @param void */ public function getlogs() { { } } /** * @access: public * @version 2.0.0 * @license BSD * @copyright (c) 2003,2004 Cezary Tomczak * @link http://gosu.pl/software/mygosulib.html */ public function showSource($file, $line, $prev = 10000, $next = 10000) { if($dir[0] == '..') return false; { return false; } $start = $line - $prev; if ($start < 1) { $start = 1; } $end = $line + $next; if ($end > $count) { $end = $count + 1; } for ($x = $start; $x <= $end; $x++) { } while ($start <= $end) { ++$start; } } } ?>
Przykład użycia:
<?php include('Error.php'); ?>
Edit: wersja skrócona, na dysku leży wersja z set_error_handler
