简体   繁体   中英

Zend_Session::start() in bootstrap

你能告诉我如何在zf应用的引导文件中包含Zend_Session :: start()吗?

Use the application resource - http://framework.zend.com/manual/en/zend.application.available-resources.html#zend.application.available-resources.session

All you need to do is provide a "session" section in your config file "resources" section.

At a minimum, I'd recommend setting a session name, eg

resources.session.name = "MyAppName"

or if using Zend_Config_Xml

<resources>
    <session>
        <name>MyAppName</name>
    </session>
</resources>    

If you want to do some session stuff in your Bootstrap class, just make sure you bootstrap the session resource first to pick up your configuration options, eg

protected function _initSessionNamespaces()
{
    $this->bootstrap('session');

    // now create your namespace(s) and whatnot
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM