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();

}

 

 

 

具体使用场景:

 

 

文章来源:外星人来地球

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


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM