試圖在Zend Framework 2上進行管理的網站,將授權設置爲mysite/admin/login
。 之後,如果授權未完成,如何拒絕訪問?Zend Framework中的會話管理2
在ZF1中,我使用了«BaseController»
,但ZF2想要在Module Module中檢查會話。
class Module
{
public function onBootstrap($e)
{
$app = $e->getApplication();
$sm = $app->getServiceManager();
$config = $sm->get('Configuration');
// DB Adapter
$adapter = $sm->get('Zend\Db\Adapter\Adapter');
GlobalAdapterFeature::setStaticAdapter($adapter);
// Session
$sessionConfig = new SessionConfig();
$sessionConfig->setOptions($config['session']);
$sessionManager = new SessionManager($sessionConfig, null, null);
Container::setDefaultManager($sessionManager);
$sessionManager->start();
}
}
告訴我我是否想做?並在哪個方向看?
[zend session和zend auth]可能的重複(http://stackoverflow.com/questions/9001847/zend-session-and-zend-auth) – chris