简体   繁体   中英

Global try catch block

I have main exception class called GlobalException. Then, I have smaller exception classes, for example ArticleException for article database management class. 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?

try print_r(variable) to see if the var is set to what you want it to be.

You could also do or die(); to the function.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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