Apply for Zend Framework Certification Training

Zend Framework 2




< ?php

namespace Application\Controller;

use Zend\Mvc\Controller\AbstractActionController;
use Zend\View\Model\ViewModel;
use MyLib\Controller\AppController;
use Zend\Session\Container;

class IndexController extends AbstractActionController {

	public function sessionAction(){
	
	    $session = new Container('User');
	    $session->email = 'example@example.com';
	    $session->name = 'Your name';
	    die('Session created');
	
	}
	
	
	public function accessSessionAction(){
	
	    $session = new Container('User');
	    
	    if($session->offsetExists('email')){
	    	print $session->offsetGet('email');
	    }
	    
	    if($session->offsetExists('name')){
	        print $session->offsetGet('name');
	    }	    
	    
	    $session->getManager()->destroy();
	    die('Session printed');
	}
}

? >                                    

< First Last >



Ask a question



  • Question:
    {{questionlistdata.blog_question_description}}
    • Answer:
      {{answer.blog_answer_description  }}
    Replay to Question


Back to Top