作者:sannyi | 来源:互联网 | 2023-10-12 09:26
Idliketobeabletocatchdie()andexit()messages.Isthispossible?Imhopingforsomethings
I'd like to be able to catch die()
and exit()
messages. Is this possible? I'm hoping for something similar to set_error_handler
and set_exception_handler
. I've looked at register_shutdown_function()
but it seems to contain no context for the offending die()
and exit()
calls.
我希望能够捕获die()和exit()消息。这是可能的吗?我希望得到与set_error_handler和set_exception_handler类似的东西。我查看了register_shutdown_function(),但它似乎不包含违规的die()和exit()调用的上下文。
I realize that die()
and exit()
are bad ways to handle errors. I am not looking to be told not to do this. :) I am creating a generic system and want to be able to gracefully log exit()
and die()
if for some reason someone (not me) decides this is a good idea to do.
我意识到die()和exit()是处理错误的不好方法。我不希望别人告诉我不要这样做。:)我正在创建一个通用系统,如果有人(而不是我)认为这是一个好主意,那么我希望能够优雅地记录exit()和die()。
7 个解决方案