Example #1
0
 public static function __callStatic($name, $params)
 {
     static $initialized = false;
     if (!$initialized) {
         require_once __DIR__ . '/autoload.php';
         self::$engine = new \system\Engine();
         $initialized = true;
     }
     return \system\core\Dispatcher::invokeMethod([self::$engine, $name], $params);
 }
Example #2
0
<?php

define('START_TIME', microtime());
require 'system/Roc.php';
Roc::set(['system.handle_errors' => true, 'system.controllers.path' => 'app/controllers', 'system.models.path' => 'app/models', 'system.views.path' => 'app/views', 'system.libs.path' => 'app/libs', 'system.router' => require 'app/config/router.php', 'db.host' => 'localhost', 'db.port' => 3306, 'db.user' => 'root', 'db.pass' => '123123', 'db.name' => 'test', 'db.charset' => 'utf8']);
Roc::path(Roc::get('system.controllers.path'));
Roc::path(Roc::get('system.models.path'));
Roc::path(Roc::get('system.libs.path'));
Roc::before('start', array('Controller', 'init'));
Roc::start();
Example #3
0
 public static function initRoute()
 {
     $router = Roc::get('system.router');
     if (is_array($router)) {
         foreach ($router as $route) {
             self::$_router[$route[1]] = $route[0];
             $tmp = explode(':', $route[1]);
             $class = '\\' . trim(str_replace('/', '\\', $tmp[0]), '\\') . 'Controller';
             $func = $tmp[1];
             $pattern = $route[0];
             Roc::route($pattern, [$class, $func]);
         }
     }
 }