Session::init PHP Method

init() public static method

starts the session
public static init ( )
    public static function init()
    {
        // if no session exist, start the session
        if (session_id() == '') {
            session_start();
        }
    }

Usage Example

 /**
  * Returns the object of the active session.
  * Tries to find an existing session. 
  * Otherwise creates a new session.
  * 
  * @return 	 Session 		$session
  */
 public function get()
 {
     // get session id
     $this->sessionID = $this->readSessionID();
     $this->session = null;
     // get existing session
     if (!empty($this->sessionID)) {
         $this->session = $this->getExistingSession($this->sessionID);
     }
     // create new session
     if ($this->session == null) {
         $this->session = $this->create();
     }
     self::$activeSession = $this->session;
     // call shouldInit event
     if (!defined('NO_IMPORTS')) {
         EventHandler::fireAction($this, 'shouldInit');
     }
     // init session
     $this->session->init();
     // call didInit event
     if (!defined('NO_IMPORTS')) {
         EventHandler::fireAction($this, 'didInit');
     }
     return $this->session;
 }
All Usage Examples Of Session::init