Simple process transactions

The transaction is to terminate the runtime error is encountered, an exception is thrown to catch

1 try {
2 if (file_exists('test_try_catch.php')) {
3 require ('test_try_catch.php');
4 } else {
5 throw new Exception('file is not exists');
6 }
7 } catch (Exception $e) {
8 echo $e->getMessage();
9 }

 

Guess you like

Origin www.cnblogs.com/maohonggang/p/11206344.html
Recommended