本文整理汇总了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'));
}
示例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();
示例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) {
}
}