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