trigger_error($className." n'existe pas !"); $Dispa->error($className." n'existe pas !"); } }); spl_autoload_register(function($traitName) { $fileName = stream_resolve_include_path(ROOT.DS.str_replace("\\",DS,$traitName).".php"); if ($fileName !== false) { include $fileName; } }); */ function debug($var) { $backtrace = debug_backtrace(); echo '<a href="#"><strong>' . $backtrace[0]["file"] . '</strong> l.' . $backtrace[0]["line"]; echo '<div class="panel"><pre>'; print_r($var); echo "</pre></div></a>"; } if (\config\Conf::$install) { core\Router::connect("Install", "/", "install/mysqlinit"); } else { //* core\Router::connect("Visiteur", "/", "utilisateur/index"); // } core\Router::connect("Normal", "/", "mediastorrent/accueil"); core\Router::connect("Torrent", "/", "mediastorrent/accueil"); core\Router::connect("Sysop", "/", "mediastorrent/accueil"); $Dispa = new core\Dispatcher(); $Dispa->load();
<?php //$mem_start = memory_get_usage(); //$start = microtime(true); //error_reporting(0); session_start(); define("IN_RULE", TRUE); date_default_timezone_set('Europe/Kiev'); require_once dirname(__FILE__) . '/engine/config.php'; require_once dirname(__FILE__) . '/engine/autoload.php'; core\Router::run(); //$time = microtime(true) - $start; //$mem = memory_get_usage() - $mem_start; //echo 'time '.$time.' seconds.<br>' ; //echo 'used memory: '. $mem .' b';
<?php /** * Файл запуска движка * */ session_start(); require 'conf/general.php'; // загрузка главного конфига, константы-пути require PATH_CORE . '/Autoloader.php'; mb_internal_encoding("UTF-8"); Autoloader::init(); core\DB::getInstance(); core\Lang::getInstance(); $oRouter = core\Router::getInstance(); if ($_SERVER['PHP_SELF'] == '/index_one.php') { // [!!!]... $oRouter->Start(); }
/** * @expectedException Exception */ public function testDispatchActionDoesntExists() { $controller = \Config::DEFAULT_CONTROLLER . "/unknownAction"; $url = $controller . "/"; $router = new \core\Router($url); $router->dispatch(true); }
<?php /** * Created by PhpStorm. * User: AVE * Date: 08.02.2016 * Time: 13:48 */ error_reporting(E_ALL); ini_set('display_errors', 1); require_once "app/init.php"; try { core\Router::route(); } catch (Exception $e) { echo "Exception: " . $e->getMessage(); }
<?php session_start(); define("IN_RULE", TRUE); require_once dirname(__FILE__) . '/engine/config.php'; require_once dirname(__FILE__) . '/engine/autoload.php'; $router = new core\Router(); $router->defineLanguage(); $router->run();
<?php //定义根目录 define('BASEDIR', __DIR__); //入口文件,去加载Init.class.php初始化 require BASEDIR . '/core/Init.class.php'; //初始化程序 core\Init::getInstance(__DIR__)->init(); //路由分发 core\Router::getInstance()->dispatch();