Esempio n. 1
0
 static function _error($msg = '')
 {
     //Logger::print_config();
     $argc = func_num_args();
     if ($argc > 1) {
         $msg = func_get_args();
     } elseif ($argc == 1) {
         $msg = func_get_arg(0);
     }
     Logger::error($msg);
 }
Esempio n. 2
0
File: api.php Progetto: ptphp/ptphp
        foreach ($reflection->getParameters() as $arg) {
            if (isset($_REQUEST[$arg->name])) {
                $fire_args[$arg->name] = $_REQUEST[$arg->name];
            } else {
                $fire_args[$arg->name] = null;
            }
        }
        $controller_obj = new $controller();
        $return = call_user_func_array(array($controller_obj, $action), $fire_args);
    } else {
        $controller_obj = new $controller();
        if (!method_exists($controller_obj, $action)) {
            _throw($controller . "::{$action} is no exsits", 9004);
        }
        //$return = $controller_obj->$action();
        $return = call_user_func_array(array($controller_obj, $action), array());
    }
    if ($return !== null) {
        $result = $return;
    }
} catch (AppException $e) {
    //print_r($exception_point);
    $error_code = $e->getCode() ? $e->getCode() : 1;
    $result = $e->getMessage();
    Logger::warn(array($error_code, $result), Utils::get_exception_file_line($e->getTrace()));
} catch (Exception $e) {
    $error_code = $e->getCode() ? $e->getCode() : 1;
    $result = $e->getMessage();
    Logger::error(array($error_code, $result, $e->getTrace()));
}
api_json_response($result, $error_code);