示例#1
0
 public static function __melody_static_method_exists($method)
 {
     if (!Config::$loaded) {
         Config::loadFor(array('www'));
     }
     $class = get_called_class();
     $intance = new $class();
     if (!method_exists(get_called_class(), '__melody_method_exists')) {
         return false;
     } else {
         return $intance->__melody_method_exists($method);
     }
 }
 static function throwError($code, $msg = '')
 {
     if (empty(Config::getAll())) {
         if (!is_null(self::$apps)) {
             Config::loadFor(self::$apps);
         } else {
             Config::loadFor(array());
         }
     }
     $action = !is_null(Config::get('access_error_' . $code . '_action')) ? Config::get('access_error_' . $code . '_action') : Config::get('access_error_default_action');
     $method_array = !is_null(Config::get('access_error_' . $code . '_controller')) ? Config::get('access_error_' . $code . '_controller') : Config::get('access_error_default_controller');
     if (is_null($action) || is_null($method_array)) {
         echo $code . ' : ' . $msg;
         exit;
     } else {
         list($controller, $method) = $method_array;
         switch ($action) {
             case 'redirect':
                 self::redirectController($controller, $method, Tools::base64url_encode(serialize(array(FrontController::$uri, $code, $msg))));
                 break;
             case 'include':
             default:
                 echo $controller::invoke($method, Request::getInstance(), $code, $msg);
                 break;
         }
     }
     exit;
 }