Bonsoir,
au lieu d'appeler l'exception, ça fait une fatal error :et je comprends pas :Fatal error: Uncaught exception 'Exception' with message 'Le fichier $path n'existe pas.' in C:\wamp\www\classe17\getmessage2.php on line 6
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 <?php header('Content-type: text/html; charset=UTF-8'); $path="./messages_err.txt"; if (!file_exists($path)) throw new Exception('Le fichier $path n\'existe pas.'); try { } catch (Exception $e) { echo 'Exception reçue : ', $e->getMessage(), "<br>"; } ?>
Partager