當前位置: 首頁>>代碼示例>>PHP>>正文


PHP SessionHandler::instance方法代碼示例

本文整理匯總了PHP中SessionHandler::instance方法的典型用法代碼示例。如果您正苦於以下問題:PHP SessionHandler::instance方法的具體用法?PHP SessionHandler::instance怎麽用?PHP SessionHandler::instance使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在SessionHandler的用法示例。


在下文中一共展示了SessionHandler::instance方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: get

 public static function get($name)
 {
     if (!SessionHandler::instance()->hasSession()) {
         return null;
     }
     return self::instance()->getSession()->get($name);
 }
開發者ID:hofmeister,項目名稱:Pimple,代碼行數:7,代碼來源:SessionHandler.php

示例2: save

 public static function save()
 {
     try {
         MessageHandler::instance()->save();
         SessionHandler::instance()->save();
     } catch (Exception $e) {
         //Do nothing...
     }
 }
開發者ID:hofmeister,項目名稱:Pimple,代碼行數:9,代碼來源:Pimple.php

示例3: hasAccess

 public function hasAccess($tag)
 {
     $entry = $this->tagRoles[strtoupper($tag)];
     if (!$entry) {
         return true;
     }
     $user = SessionHandler::instance()->getUser();
     return $entry->isValid($user ? $user->getRole() : self::R_GUEST);
 }
開發者ID:hofmeister,項目名稱:Pimple,代碼行數:9,代碼來源:AccessHandler.php

示例4: loadFromSID

 public function loadFromSID($SID)
 {
     $result = CouchDB::client()->key($SID)->include_docs(true)->getView("session", 'all');
     if (count($result->rows) > 0) {
         $this->document = current($result->rows)->doc;
     }
     if (!$this->document) {
         $this->document = new stdClass();
     }
     $this->document->SID = $SID;
     $this->document->type = 'session';
     $this->document->expires = SessionHandler::instance()->getExpires();
     return $this;
 }
開發者ID:hofmeister,項目名稱:ScrumBanana.com,代碼行數:14,代碼來源:SessionModel.php

示例5: register

 public function register()
 {
     $this->validate(array('name' => 'required,min(2)', 'email' => 'required,email', 'password' => 'required,min(4)', 'password2' => 'required,min(4),equal(password)'));
     $userDoc = Request::post()->get('name', 'email', 'password');
     $userDoc->password = md5($userDoc->password);
     $userDoc = UserService::save($userDoc);
     if (!$userDoc) {
         MessageHandler::instance()->addError('E-mail was already registered - forgot your password?');
         return;
     }
     $user = new UserModel($userDoc);
     SessionHandler::instance()->setUser($user);
     MessageHandler::instance()->addMessage('You were successfully registered and logged in');
     $this->redirect();
 }
開發者ID:hofmeister,項目名稱:ScrumBanana.com,代碼行數:15,代碼來源:UserController.php

示例6: define

<?php

define('BASEURL', dirname($_SERVER['SCRIPT_NAME']) . '/');
require_once 'settings.php';
//Init session
SessionHandler::instance()->setSessionKey('SCRUMSID');
SessionHandler::instance()->setSession(new SessionModel());
SessionHandler::instance()->setExpires(3600 * 24 * 7);
SessionHandler::instance()->init();
//Init pimple
Pimple::instance()->run();
開發者ID:hofmeister,項目名稱:ScrumBanana.com,代碼行數:11,代碼來源:bootstrap.php


注:本文中的SessionHandler::instance方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。