Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /*in the Bootstrap.php file in application/ folder put this code to initiate the session:*/
- protected function _initSession()
- {
- $session = new Zend_Session_Namespace('your-project-name-here', true);
- $session->setExpirationSeconds(7*86400); // expire in 7 days
- Zend_Registry::set('session', $session);
- }
- /* to use it to store data between requests: */
- public function exampleFirstAction() {
- $session = Zend_Registry::get('session');
- // set data in session
- $session->foo = 'bar';
- }
- public function exampleSecondAction() {
- $session = Zend_Registry::get('session');
- // get data from session in other place
- if (isset($session->foo)) {
- echo $session->foo;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment