本文整理匯總了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();