PHP ErrorFlag check?
I am writing a PHP class that is broken down to a few simple function. In the constructor function it calls one other function called processFile. This function calls 5 private functions and does checks. if the check fails it assigns the a开发者_高级运维 message to a $var and i have a flag variable that gets set to 1 when the error has occurred. iam trying to a write something in the function processFile to check if the errorFlag is set, and it it is then not calling the other functions. How would i go about doing this?
You can use exception:
if (...) {
throw new Exception(....);
}
Add try..catch block in script which create this object.
精彩评论