简体   繁体   English

全局尝试捕获块

[英]Global try catch block

I have main exception class called GlobalException. 我有一个名为GlobalException的主要异常类。 Then, I have smaller exception classes, for example ArticleException for article database management class. 然后,我有较小的异常类,例如文章数据库管理类的ArticleException。 Each of these smaller exception classes handles the exception at local level and then throws GlobalException , where I can log the error to error log,... Is there some way I could have global try catch block for GlobalException everywhere, where I include some PHP script, without the need to write try catch block for every file? 这些较小的异常类中的每一个都在本地级别处理异常,然后引发GlobalException,在该异常中我可以将错误记录到错误日志中,...有某种方法可以使遍历GlobalException的全局try catch块随处可见,其中包括一些PHP脚本,而无需为每个文件编写try catch块?

try print_r(variable) to see if the var is set to what you want it to be. 尝试使用print_r(variable)查看var是否设置为您想要的值。

You could also do or die(); 你也可以做或者死(); to the function. 功能。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM