zoukankan      html  css  js  c++  java
  • Introducing AkrabatSession zf2

     

    One of the requirements for a new app that I'm writing is that it has a specific session name. In Zend Framework 2, this is done by creating a SessionManager with the correct configuration and then setting the default manager on the Session Container:

     

    use Zend\Session\Config\SessionConfig;
    use Zend\Session\SessionManager;
    use Zend\Session\Container;
     
    $sessionConfig = new SessionConfig();
    $sessionConfig->setOptions(array('name'=>'MY_SESSION_NAME');
    $sessionManager = new SessionManager($config);
    Container::setDefaultManager($sessionManager);

     

    Obviously, I need to be able to configure the name (and potentially other session configuration options) from myconfig/autoload/global.php file and this is a generically useful requirement, so I created the AkrabatSession module.

     

    This is a really simple module that simply allows you to configure the SessionManager with minimal effort:

     

    1. Install AkrabatSession.
    2. Enable it as the first module in application.config.php
    3. Add the following to your configuration array in global.php:
          'session' => array(
              'name' => 'MY_SESSION_NAME_HERE',
          ),

     

  • 相关阅读:
    文本属性和属性连写
    并集选择器
    子代选择器
    后代选择器
    交集选择器
    xpath helper 表格爬取
    爬取xiachufang图片试手
    bs4 beautifullsoup网页内容选择器
    requests第三方库使用 抓取
    python 爬虫学习
  • 原文地址:https://www.cnblogs.com/xuyaoxiang/p/3044493.html
Copyright © 2011-2022 走看看