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


PHP ezcPersistentSessionInstance::set方法代碼示例

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


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

示例1: testSetWithIdentifierMixed

 public function testSetWithIdentifierMixed()
 {
     $session = $this->getSession();
     $sessionDecorator = $this->getSessionDecorator($session);
     ezcPersistentSessionInstance::set($session, 'session');
     ezcPersistentSessionInstance::set($sessionDecorator, 'decorator');
     $this->assertSame($session, ezcPersistentSessionInstance::get('session'));
     $this->assertSame($sessionDecorator, ezcPersistentSessionInstance::get('decorator'));
 }
開發者ID:bmdevel,項目名稱:ezc,代碼行數:9,代碼來源:instance_test.php

示例2: define

    ezcBase::autoload($className);
    @(include SITE_ROOT . '/app/model/' . $className . '.php');
}
define('SITE_ROOT', dirname(__FILE__) . '/..');
define('APP_ROOT', dirname(__FILE__) . '/../app');
$cfg = ezcConfigurationManager::getInstance();
$cfg->init('ezcConfigurationIniReader', SITE_ROOT . '/settings');
define('DIR_DEFINITIONS', SITE_ROOT . '/app/model/definitions');
ezcBase::addClassRepository('.', SITE_ROOT . '/core/autoloads');
$driver = $cfg->getSetting('config', 'Database', 'Driver');
$host = $cfg->getSetting('config', 'Database', 'Host');
$port = $cfg->getSetting('config', 'Database', 'Port');
$username = $cfg->getSetting('config', 'Database', 'User');
$password = $cfg->getSetting('config', 'Database', 'Password');
$database = $cfg->getSetting('config', 'Database', 'Database');
$dsn = $driver . '://' . $username . ':' . $password . '@' . $host . '/' . $database;
define('DB_DSN', $dsn);
$dbInstance = ezcDbFactory::create(DB_DSN);
ezcDbInstance::set($dbInstance);
@(include_once SITE_ROOT . '/settings/log.php');
/*
$dbSession = new ezcPersistentSession( $dbInstance,
        new ezcPersistentCacheManager( new ezcPersistentCodeManager( DIR_DEFINITIONS ) ) );
*/
$dbSession = new ezcPersistentSession($dbInstance, new ezcPersistentCacheManager(new JFPersistentDefinitionManager()));
$identityMap = new ezcPersistentBasicIdentityMap($dbSession->definitionManager);
$session = new ezcPersistentSessionIdentityDecorator($dbSession, $identityMap);
ezcPersistentSessionInstance::set($session);
// set default session
// retrieve the session
//$session = ezcPersistentSessionInstance::get();
開發者ID:jpic,項目名稱:Jetfuel,代碼行數:31,代碼來源:common.php

示例3: testResetWithIdentifiers

 public function testResetWithIdentifiers()
 {
     $manager = new ezcPersistentCodeManager(dirname(__FILE__) . "/PersistentObject/tests/data/");
     $session1 = new ezcPersistentSession(ezcDbInstance::get(), $manager);
     $session2 = new ezcPersistentSession(ezcDbInstance::get(), $manager);
     ezcPersistentSessionInstance::set($session1, 'first');
     ezcPersistentSessionInstance::set($session2, 'secondary');
     $this->assertSame($session1, ezcPersistentSessionInstance::get('first'));
     $this->assertSame($session2, ezcPersistentSessionInstance::get('secondary'));
     ezcPersistentSessionInstance::reset();
     try {
         ezcPersistentSessionInstance::get('first');
         $this->fail("Getting a non existent instance did not fail.");
     } catch (ezcPersistentSessionNotFoundException $e) {
     }
     try {
         ezcPersistentSessionInstance::get('secondary');
         $this->fail("Getting a non existent instance did not fail.");
     } catch (ezcPersistentSessionNotFoundException $e) {
     }
 }
開發者ID:jacomyma,項目名稱:GEXF-Atlas,代碼行數:21,代碼來源:persistent_session_instance_test.php


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