PHP学習ノート三十五【Try】

2458 ワード

<?php 

 

   

   function AddUser($name)

   {

     if($name=="  ")

     {

       echo "add success";

       return true;

     }else

     {

        throw new Exception("    ");

     }

   }

 

   function updateUser($username)

   {

    if($username=="  ")

    {

     return true;

    }else{

     throw new Exception("    !");

    }

   }

   function A(){

    

     try{

     $res1=AddUser("hell");

     $res2=updateUser("world");

    }catch(Exception $ex)

    {

      echo "    !    :".$ex->getMessage();

    

    }

   

   }

 

   A();



    

?>