PHP学习笔记三十二【Exception】

<?php 

   // $fp=fopen("a.txt","r");

   // echo "ok";

  if(!file_exists("a.txt"))

  {

     exit();//退出

  }

   

   //使用die处理异常

   if(!file_exists("a.txt"))

  {

   die("文件不存在");//打印提示再退出,不会再继续执行

    // exit();

  }else

  {

    

  }

  

  //用法2

  file_exists("a.txt") or die("文件不存在");

  

  

?>

 

你可能感兴趣的:(exception)