码迷,mamicode.com
首页 > Web开发 > 详细

php 异常

时间:2017-11-10 20:24:04      阅读:194      评论:0      收藏:0      [点我收藏+]

标签:exce   message   sharp   return   ret   except   highlight   erro   cat   

class customException extends Exception
{
    public function errorMessage()
    {
        //error message
        $errorMsg = ‘Error on line ‘.$this->getLine().‘ in ‘.$this->getFile()
            .‘: <b>‘.$this->getMessage().‘</b> ‘;
        return $errorMsg;
    }
}

try
{
   throw  new customException("error le ");
}

catch (customException $e)
{
    //display custom message
    echo $e->errorMessage();
}
?>

  

php 异常

标签:exce   message   sharp   return   ret   except   highlight   erro   cat   

原文地址:http://www.cnblogs.com/php-linux/p/7815752.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!