本文整理汇总了PHP中UserSession::isLoggedIn方法的典型用法代码示例。如果您正苦于以下问题:PHP UserSession::isLoggedIn方法的具体用法?PHP UserSession::isLoggedIn怎么用?PHP UserSession::isLoggedIn使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UserSession
的用法示例。
在下文中一共展示了UserSession::isLoggedIn方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: define
// Auto Loaders
include_once '../private/autoloaders/autoloader main.php';
// LESS Compiler
include_once "../private/includes/less.inc.php";
/* Use for when in a sub-folder
define('BASE_PATH', '/subDirectory/directory/');*/
// Start Slim's Instance & Twig View
$app = new \Slim\Slim(array('mode' => 'development', 'view' => new \Slim\Views\Twig(), 'templates.path' => '../private/templates/'));
$app->configureMode('development', function () use($app) {
$app->config(array('log.enable' => false, 'debug' => true));
/// Moved to top to catch any bugs above this for now.
//define('DEBUGGING', true);
//ini_set("display_errors", 1);
//error_reporting(E_ALL);
});
// Set Global View Data
$view = $app->view();
$app->view->getInstance()->addFilter(new Twig_SimpleFilter('debug', 'debug'));
$view->setData(array('loggedIn' => UserSession::isLoggedIn(), 'siteName' => 'Lite Stack PHP', 'siteShort' => 'LS'));
//endregion </Init>
//region <Middleware>
$authCheck = function () use($app) {
if (!UserSession::isLoggedIn()) {
$app->flash('error', "You must be logged in to access this page");
$app->redirect('/');
}
};
//endregion </Middleware>
// Routing
include_once 'routing.php';
$app->run();