本文整理汇总了PHP中Routes::run方法的典型用法代码示例。如果您正苦于以下问题:PHP Routes::run方法的具体用法?PHP Routes::run怎么用?PHP Routes::run使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Routes
的用法示例。
在下文中一共展示了Routes::run方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: StartApp
public static function StartApp()
{
ob_start('ob_gzhandler');
session_start();
// Defines
define('BASEURL', substr((empty($_SERVER['HTTPS']) ? 'http://' : 'https://' ) . $_SERVER['SERVER_NAME'] . $_SERVER['PHP_SELF'],0,-10));
define('BASEPATH', substr($_SERVER['SCRIPT_FILENAME'],0,-10));
// Helper Boot Loader
require(BASEPATH.'/core/bootloader.php');
// Initialize Helpers
BootLoader::loadHelpers();
Registry::getInstance();
// Handle Errors
Registry::setDebugMode(true);
set_error_handler('Template::handleError');
set_exception_handler('Template::handleException');
// Initialize Database
Model::$db = DBO::getInstance('sqlite:example.sqldb');
// Init Autoloads
spl_autoload_register('Autoload::controllers');
spl_autoload_register('Autoload::models');
// Determine Controllers and Methods
Routes::getRoute();
// Run Application
Routes::run();
}
示例2: run
function run()
{
$config = parse_ini_file('../.config');
$this->setUpDb();
$showErrors = isset($config['showErrors']) ? $config['showErrors'] : false;
$configuration = ['settings' => ['displayErrorDetails' => $showErrors]];
$c = new \Slim\Container($configuration);
// create new Slim instance
$app = new \Slim\App($c);
// create new Slim instance
//$app = new \Slim\App();
$app->db = $this->database;
$this->flashDB(false);
$app->auth = false;
$app->user = '';
$app->register = $config['registerActive'];
$app->add(function ($request, $response, $next) use(&$app) {
if (isset($_SESSION['userID'])) {
$app->auth = true;
$app->user = $_SESSION['username'];
}
$response = $next($request, $response);
return $response;
});
$container = $app->getContainer();
$container['view'] = function ($c) {
// templates location and a settings array
$view = new \Slim\Views\Twig('../templates', ['cache' => '../cache', 'auto_reload' => true, 'debug' => true]);
// Instantiate and add Slim specific extension
$view->addExtension(new Slim\Views\TwigExtension($c['router'], $c['request']->getUri()));
return $view;
};
$route = new Routes($app);
$app = $route->run($app);
$this->app = $app;
// Run app
$this->app->run();
}
示例3:
<?php
// Load up the framework
require_once 'core/autoload.php';
// Run the current route
Routes::run();
示例4: ini
public static function ini()
{
include_once "../app/Routes.php";
Routes::run();
}