开发者

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.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜