I did some searching for this, but it's a little too generic to pull up results. I'm quite sure it can be done, but I can't find the right posts. Basically I am using CodeIgniter as my back end, and I throw exceptions from EVERYWHERE. When an exception happens, I want to throw the user to an error page BUT I also want to include the error message and stack trace so I can store it into my error table. The worst case scenario开发者_如何学C would be to put all my code into a try-catch loop, but that's ridiculous. Is there anything I can do with something like the .htaccess file? Remember, I need the exception to be passed along with the redirect.
Take a look at the set_exception_handler and set_error_handler functions, I think that's what you're looking for. Also at the Error Handling session on the PHP Documentation.
精彩评论