开发者

Redirect php error to error page along with error thrown

开发者 https://www.devze.com 2023-02-02 11:52 出处:网络
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, an

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号