本文整理汇总了PHP中Route::instance方法的典型用法代码示例。如果您正苦于以下问题:PHP Route::instance方法的具体用法?PHP Route::instance怎么用?PHP Route::instance使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Route
的用法示例。
在下文中一共展示了Route::instance方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getInstance
public static function getInstance()
{
if (Route::$instance == null) {
Route::$instance = new Route();
}
return Route::$instance;
}
示例2: getInstance
/**
* @return mixed
*/
public static function getInstance()
{
if (!isset(self::$instance)) {
$c = __CLASS__;
self::$instance = new $c();
}
return self::$instance;
}
示例3: run
/**
* start the app
*/
public function run()
{
$this->_initRegister();
date_default_timezone_set($this->config['timezone']);
if (false === IS_CLI) {
$this->route = Route::instance()->init();
$this->controller = Controller::create($this->route);
}
}
示例4: start
public static function start()
{
$ds = DIRECTORY_SEPARATOR;
include 'vendor' . $ds . 'simple' . $ds . 'base' . $ds . 'Loader' . EXT;
include 'vendor' . $ds . 'simple' . $ds . 'base' . $ds . 'Handler' . EXT;
include 'vendor' . $ds . 'simple' . $ds . 'base' . $ds . 'Route' . EXT;
spl_autoload_register(['Loader', 'autoload']);
//set the error and exception handlers
Handler::set();
//set the routes
Route::instance()->run();
}
示例5: __construct
public function __construct($layout = '', $view = '')
{
$this->_conf = Config::instance();
if (!empty($layout)) {
$this->_layout = $layout;
} else {
$this->_layout = $this->_conf->get('default_layout');
}
if (!empty($view)) {
$this->_view = $view;
} else {
$router = Route::instance();
$this->_view = className2fileName($router->controller()) . DS . $router->action();
}
}
示例6:
<?php
$route = Route::instance();
$route->connect('page/(\\d*)/(\\d*)', 'pages_FirstPage/index/$1/$2');
$route->connect('page', 'page/index');
$route->connect('page/test', 'test/main');
unset($route);
示例7: array
* Подключения файла с функциями
*/
include_once CORE_PATH . DS . 'functions.php';
//errorReporting ();
/*
* Добовляются пути к include_path
*/
$includePath = array(APP_PATH . DS . 'classes', CORE_PATH . DS . 'classes', get_include_path());
$includePath = implode(PATH_SEPARATOR, $includePath);
set_include_path($includePath);
/**
*
* автолод для подключения классов
*/
function __autoload($class)
{
$file = className2fileName($class) . '.php';
include_once $file;
}
include_once APP_PATH . DS . 'config' . DS . 'app_config.php';
// фаил конфигурации приложения
$config = Config::instance();
include_once APP_PATH . DS . 'config' . DS . 'routes.php';
$router = Route::instance();
//подключаем роут
$route = $router->getRoute($_SERVER['REQUEST_URI']);
//текущий роут
errorReporting();
//вывод ошибок
dispatch($route);
//фронт контроллер
示例8: instance
public static function instance()
{
if (!self::$instance instanceof self) {
return self::$instance = new self();
}
}