本文整理匯總了PHP中Zend\Session\SessionManager::setConfig方法的典型用法代碼示例。如果您正苦於以下問題:PHP SessionManager::setConfig方法的具體用法?PHP SessionManager::setConfig怎麽用?PHP SessionManager::setConfig使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Zend\Session\SessionManager
的用法示例。
在下文中一共展示了SessionManager::setConfig方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: configure
public function configure($object, array $options = [])
{
$manager = new Session\SessionManager();
$manager->setStorage(new Session\Storage\ArrayStorage());
$manager->setSaveHandler(new Session\SaveHandler\Cache(new CacheStorageAdapterMemory()));
$manager->setConfig(new Session\Config\StandardConfig());
$session = new Session\Container('Default', $manager);
$object->getServiceLocator()->set('Zend\\Session\\Container', $session);
}
示例2: onBootstrap
public function onBootstrap(MvcEvent $e)
{
$eventManager = $e->getApplication()->getEventManager();
$moduleRouteListener = new ModuleRouteListener();
$moduleRouteListener->attach($eventManager);
$settings = $e->getApplication()->getServiceManager()->get("Config");
if (isset($settings['zDbSession']) && $settings['zDbSession']['enabled']) {
$sessionConfig = new \Zend\Session\Config\SessionConfig();
$sessionConfig->setOptions($settings['zDbSession']['sessionConfig']);
$saveHandler = new DoctrineGateway($e->getApplication()->getServiceManager());
$sessionManager = new SessionManager();
$sessionManager->setConfig($sessionConfig);
$sessionManager->setSaveHandler($saveHandler);
Container::setDefaultManager($sessionManager);
$sessionManager->start();
}
}
示例3: setSessionStorage
public function setSessionStorage()
{
$gwOpts = new DbTableGatewayOptions();
$gwOpts->setDataColumn('data');
$gwOpts->setIdColumn('id');
$gwOpts->setLifetimeColumn('lifetime');
$gwOpts->setModifiedColumn('modified');
$gwOpts->setNameColumn('name');
if (isset($this->serviceConfig['base64Encode']) && $this->serviceConfig['base64Encode']) {
$saveHandler = new EncodedDbTableGateway($this->tblGW, $gwOpts);
} else {
$saveHandler = new DbTableGateway($this->tblGW, $gwOpts);
}
$sessionManager = new SessionManager();
if ($this->sessionConfig) {
$sessionConfig = new \Zend\Session\Config\SessionConfig();
$sessionConfig->setOptions($this->sessionConfig);
$sessionManager->setConfig($sessionConfig);
}
$sessionManager->setSaveHandler($saveHandler);
Container::setDefaultManager($sessionManager);
$sessionManager->start();
}
示例4: getSessionAdapter
/**
* Retorna o adaptador de sessao
* @param string $name
* @return SessionContainer
*/
public function getSessionAdapter($name = 'Default')
{
if (!isset($_SESSION[$name])) {
$sessionConfig = new SessionConfig();
$sessionConfig->setOptions($this->globalConfig['session']);
$sessionStorage = new \Zend\Session\Storage\SessionArrayStorage();
$sessionManager = new SessionManager();
$sessionManager->rememberMe($this->globalConfig['session']['remember_me_seconds']);
$sessionManager->forgetMe();
$sessionManager->setConfig($sessionConfig);
$sessionManager->setStorage($sessionStorage);
$sessionNamespace = new SessionContainer($name, $sessionManager);
$sessionNamespace->setExpirationSeconds(3600);
if (!isset($sessionNamespace->init)) {
$request = new \Zend\Http\PhpEnvironment\Request();
$sessionNamespace->init = 1;
$sessionNamespace->remoteAddr = $request->getServer('REMOTE_ADDR');
$sessionNamespace->httpUserAgent = $request->getServer('HTTP_USER_AGENT');
/*
$chain = $sessionManager->getValidatorChain();
$validatorUserAgent = new \Zend\Session\Validator\HttpUserAgent($sessionNamespace->httpUserAgent);
$chain->attach('session.validate', array($validatorUserAgent, 'isValid'));
$validatorAddr = new \Zend\Session\Validator\RemoteAddr($sessionNamespace->remoteAddr);
$chain->attach('session.validate', array($validatorAddr, 'isValid'));
$sessionManager->setValidatorChain($chain);
*
*/
}
$sessionNamespace->setDefaultManager($sessionManager);
} else {
$sessionNamespace = new SessionContainer($name);
$sessionNamespace->setExpirationSeconds(3600);
}
$this->sessionAdapter = $sessionNamespace;
return $sessionNamespace;
}