Contoh
Lempar Exception dan keluarkan jalur file tempat exception terjadi:
<?php try { throw new Exception("An error occurred"); } catch(Exception $e) { echo "Error in this file: " . $e->getFile(); } ?> // output : Error in this file: /home/TwT0ln/prog.php
Section Artikel
Metode getFile()
dapat digunakan untuk mengembalikan jalur absolut ke file tempat pengecualian terjadi.
$exception->getFile()
Nilai Kembalian: | Mengembalikan string |
---|