本文整理汇总了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 () {