本文整理匯總了PHP中Zend\Session\SessionManager::getStorage方法的典型用法代碼示例。如果您正苦於以下問題:PHP SessionManager::getStorage方法的具體用法?PHP SessionManager::getStorage怎麽用?PHP SessionManager::getStorage使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Zend\Session\SessionManager
的用法示例。
在下文中一共展示了SessionManager::getStorage方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: testCanPassStorageToConstructor
public function testCanPassStorageToConstructor()
{
$storage = new Session\Storage\ArrayStorage();
$manager = new SessionManager(null, $storage);
$this->assertSame($storage, $manager->getStorage());
}
示例2: aggregateImpactInSession
/**
* If configured aggregate the impact from the report in the session and return the updated value.
* @param IDS_Report $report
* @return int
*/
protected function aggregateImpactInSession(IDS_Report $report)
{
if ($this->config['aggregate_in_session']) {
$sessionManager = new SessionManager();
$sessionManager->start();
$session = $sessionManager->getStorage();
if (!isset($session->ZeSecurityIDS)) {
$session->ZeSecurityIDS = array('impact' => 0);
}
$impact = $session->ZeSecurityIDS['impact'];
$impact += $report->getImpact();
$session->ZeSecurityIDS['impact'] = $impact;
} else {
$impact = $report->getImpact();
}
return $impact;
}
示例3: getSession
/**
* return a session storage instance
* @return \Zend\Session\Storage\StorageInterface
*/
protected function getSession()
{
$sessionManager = new SessionManager();
$sessionManager->start();
return $sessionManager->getStorage();
}
示例4: testCanPassStorageClassToConfigurationOptions
public function testCanPassStorageClassToConfigurationOptions()
{
$manager = new SessionManager(array('storage' => 'Zend\\Session\\Storage\\ArrayStorage'));
$storage = $manager->getStorage();
$this->assertTrue($storage instanceof Session\Storage\ArrayStorage);
}
示例5: registerShutdownFunction
/**
* According to the PHP manual, session_write_close should always be
* registered as a shutdown function when using an object as a session
* handler: http://us.php.net/manual/en/function.session-set-save-handler.php
*
* This method sets that up.
*
* @param SessionManager $sessionManager Session manager instance
*
* @return void
*/
protected function registerShutdownFunction(SessionManager $sessionManager)
{
register_shutdown_function(function () use($sessionManager) {
// If storage is immutable, the session is already closed:
if (!$sessionManager->getStorage()->isImmutable()) {
$sessionManager->writeClose();
}
});
}