コード例 #1
0
function Err_ExceptionHandler($e)
{
    $type = 'Exception';
    $sql = '';
    if (substr($e->getMessage(), 0, 3) == 'SQL') {
        $ob = ob::instance();
        $type = 'Database';
        foreach ($ob->_dbs as $key => $val) {
            if (is_object($ob->{$key})) {
                $sql .= $ob->{$key}->last_query($ob->{$key}->prepare);
            }
        }
    }
    ob_start();
    include SYS . 'error' . DS . 'err_exception' . PHP_EXT;
    $buffer = ob_get_contents();
    ob_end_clean();
    //log_php_errors('Exception', $e->getMessage(), $e->getFile(), $e->getLine());
    echo $buffer;
}
コード例 #2
0
ファイル: handle.php プロジェクト: zhaozhenxiang/MyDPByPHP
        echo __CLASS__ . $a;
    }
}
class ob
{
    private $list = [];
    private $msg = '';
    public function add(informant $in)
    {
        $this->list[] = $in;
    }
    public function setMessage($a)
    {
        $this->msg = $a;
    }
    public function action()
    {
        foreach ($this->list as $key => $item) {
            $item->send($this->msg);
        }
    }
}
$informant1 = new informant1();
$informant2 = new informant2();
$informant3 = new informant3();
$ob = new ob();
$ob->add($informant1);
$ob->add($informant2);
$ob->add($informant3);
$ob->setMessage(__LINE__);
$ob->action();