dth20986 2010-01-29 16:39
浏览 11
已采纳

停止php功能

I have this code that simply validates a date, but ends the script if a error occurs (exit ()).

Now i want to put this same code in a single function that returns false on error.

I dont want to use "if/else". I want to return false on error and stop execution of the others things.

Is that possible?

  • 写回答

3条回答 默认 最新

  • dty5753 2010-01-29 16:45
    关注

    you could change

    exit ("Error !");
    

    to

    return false;
    

    but exceptions would definitely be better as suggested by Ignacio Vazquez-Abrams

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(2条)

报告相同问题?