PHP try catch 如何使用

 

<?php

 

try {

if (file_exists('test_try_catch.php')) {

require ('test_try_catch.php');

} else {

throw new Exception('file is not exists');

}

} catch (Exception $e) {

echo $e->getMessage();

}

 

 

 

具体使用场景:

 

 

文章来源:外星人来地球

欢迎关注,有问题一起学习欢迎留言、评论

猜你喜欢

转载自www.cnblogs.com/lovebing/p/11505553.html
今日推荐