开发者

PHP ErrorFlag check?

开发者 https://www.devze.com 2023-03-29 21:30 出处:网络
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 chec

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

精彩评论

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

关注公众号