错误和异常处理 使用模板

配置文件php.ini可以直接配置错误处理方式

错误处理

参见 syslog().

异常处理

<?php
class myException extends Exception
{
    public function getErrorMessage()
    {
        return "出现了自定义错误";
    }
}
try
{
    throw new myException();
}
catch(Exception $e)
{
    echo $e->getErrorMessage()."<br>";
}
?>

使用模板

<?php
require("Smarty.class.php");

?>

 

posted on 2016-01-13 22:08  峰入云  阅读(391)  评论(0)    收藏  举报

导航