我对PHP不是很流畅,因为我只是暂时使用它。我的代码的性质非常简单,它确实有一些情况涉及"未捕获的异常:退出"。
我如何使用异常处理程序在收到此错误时告诉它重新启动代码?
参见:http://php.net/manual/en/language.exceptions.php
使用try-catch
语句:
try {
//your code here
} catch (Exception e) {
// do something if an exception is thrown.
}