php 学习记录:

1.php异常处理:

 1 <?php
 2 header("content-type: text/html; charset=utf8");
 3 
 4 function at(){
 5     try{
 6         echo '异常处理 --->';
 7         throw new Exception('发生异常!aa');
 8     }catch(Exception $e){
 9         echo '铺货异常:'.$e->getMessage();
10     }
11 }
12 
13 at();
View Code
 1 <?php
 2 header("content-type: text/html; charset=utf8");
 3 
 4 function at(){
 5     try{
 6         echo '异常处理 --->';
 7         throw new \Exception('发生异常!aa');
 8     }catch(\Exception $e){
 9         echo '铺货异常:'.$e->getMessage();
10     }
11 }
12 
13 at();
View Code

猜你喜欢

转载自www.cnblogs.com/wsybky/p/9318765.html
今日推荐