json - PHP Always run function -
I'm trying to get some errors back in JSON format. Therefore, I have created a class level:
public $ errors = Array ();
Therefore, can lower various functions returned in the script, and add their error to the $ errors array but, I have to use the refund; In some places to stop the script after an error.
So, when I do this, how can I still run my last error function which will return all the collected errors? How can I get around the issue of script prevention, but still want to return the errors that I need to stop the script ?!
If you are using PHP5 +, then click Destruct The method can be:
Public function __destruct () {die (var_dump $ this-> Errors)); }
Comments
Post a Comment