Is sending error report from PHP Exception __destruct() method a Good or Bad Idea?
问题 I am designing an error handling system for my application. I want to base it on exceptions, and I want to get notified by email about every exception which I had not expected. I thought of a class: class My_Exception extends Exception { private $sendErrorReport = true; public function __destruct() { if ($this->sendErrorReport) { // send the error report by email } } public function cancelErrorReport() { $this->sendErrorReport = false; } } And I want to do something like this: try { do