Beispiel #1
0
<?php

session_start();
set_include_path('scripts' . PATH_SEPARATOR . get_include_path());
require_once 'config.php';
include 'autoloader.php';
require_once 'config-router.php';
$router = new \Router\Router('http://' . $_SERVER["SERVER_NAME"] . $_SERVER["REQUEST_URI"]);
$router->run();
$file = $router->getFile();
$classController = $router->getClass();
$method = $router->getMethod();
require_once $file;
$obj = new $classController();
$obj->{$method}();
Beispiel #2
0
<?php

/**
 * Author: Vehsamrak
 * Date Created: 19.01.16 21:34
 */
const ROOT_DIRECTORY = __DIR__;
error_reporting(E_ALL);
ini_set('display_errors', 1);
spl_autoload_register(function ($className) {
    $className = str_replace("\\", "/", $className);
    $namespace = str_replace("\\", "/", __NAMESPACE__) ?: '/';
    $class = ROOT_DIRECTORY . "/src/" . $namespace . $className . ".php";
    if (file_exists($class)) {
        include_once $class;
    }
});
$router = new Router\Router();
$controller = $router->run();