コード例 #1
0
ファイル: Boot.php プロジェクト: alebon/url-shortener-php
            // Development settings
            error_reporting(E_ALL);
            ini_set('display_errors', 'On');
        } else {
            // Production settings
            error_reporting(E_ALL);
            ini_set('display_errors', 'Off');
        }
    }
    /**
     * Invoke controller based on URL structure
     */
    function invokeController()
    {
        $url = "";
        if (isset($_GET['url'])) {
            $url = $_GET['url'];
        }
        /** @var ControllerInterface $controller */
        $controller = Router::getController($url);
        if ((int) method_exists($controller, $controller->getAction() . 'Action')) {
            call_user_func_array(array($controller, $controller->getAction() . 'Action'), array());
        } else {
            /* Error Generation Code Here */
        }
    }
}
$bootstrap = new Boot();
$bootstrap->setErrorReporting();
$bootstrap->setUp();
$bootstrap->invokeController();