php异常处理
异常处理能增强程序的可维护性。函数应该有一系列的输入,并且有唯一的输出。在参数不正确、或者发生系统错误时,我们需要告知使用者发生了什么样的错误,便于使用者处理和记录。
function foo($content){
if(!is_string($content)){
hrow new Exception('参数类型不正确$content');
}
}
posted on 2016-08-10 16:26 sunqisteven 阅读(92) 评论(0) 收藏 举报
浙公网安备 33010602011771号