本文整理匯總了PHP中Flight::before方法的典型用法代碼示例。如果您正苦於以下問題:PHP Flight::before方法的具體用法?PHP Flight::before怎麽用?PHP Flight::before使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Flight
的用法示例。
在下文中一共展示了Flight::before方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1:
<?php
/**
* TinyMe Application
*/
require __DIR__ . "/../bootstrap/init.php";
Flight::before('start', ['TinyMe', 'bootstrap']);
Flight::start();
示例2: array
<?php
/**
* Demo Application
*/
require __DIR__ . "/bootstrap/init.php";
Flight::before("start", array("Controller", "init"));
Flight::start();
示例3: Twig_Loader_Filesystem
* Initiate Twig, and register to Flight
*/
$twigLoader = new Twig_Loader_Filesystem('../templates');
$twigConfig = array('cache' => Flight::get('config')->get('cache.enabled') ? Flight::get('config')->get('cache.path') . 'twig/' : false, 'debug' => Flight::get('config')->get('debug'));
Flight::register('view', 'Twig_Environment', array($twigLoader, $twigConfig), function ($twig) {
$twig->addExtension(new Twig_Extension_Debug());
// Add the debug extension
$currentUrl = sprintf("%s://%s%s", isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != 'off' ? 'https' : 'http', $_SERVER['SERVER_NAME'], $_SERVER['REQUEST_URI']);
$twig->addGlobal('CurrentUrl', $currentUrl);
});
/**
* Add navigation hook on start, get all links and store them in config -> 'app.navigation'
*/
Flight::before('start', function (&$params, &$output) {
if (Flight::has('navigation.loader')) {
return;
}
Flight::get('config')->initNavigation(Flight::request()->url);
});
// ! --- ROUTE: Index ---------------------------
Flight::route('/', function () {
return Flight::view()->display('index.php', Flight::get('config')->getTemplateData());
});
// ! --- ROUTE: About ---------------------------
Flight::route('/we', function () {
return Flight::get('config')->renderPage('about');
});
// ! --- ROUTE: Sitemap -------------------------
/**
* Publishes all routes in the /sitemap.xml
*/
Flight::route('/sitemap.xml', function () {