Bonjour,
J'ai faite une petite classe. C'est un gestionnaire d'exceptions.
dans mon header j'ai mis cela
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27 <?php /** * @fonctionment Register all the error in a log file * @author Marwan Rabbaa * @version 1.0 * @since 05/03/2008 */ class FileHandler extends Exception { private $directory; // the direcory where is stored HTML files private $logfile; /** The constructor */ public function __construct() { $this->directory = 'error/'; $this->logfile = new LogFile("err"); } /** The only public method * @action Write in a file and redirect user to an error page */ public function handle($e) { header($this->directory.'application.php'); $this->logfile->write('ERROR'); } }
donc dès que je throw un exception j'execute la fonction handle
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2 $handler = new FileHandler(); set_exception_handler(array($handler,"handle"));
mais tout fonctionne sauf le header, pourquoi ?
Partager