示例#1
0
 /**
  * if session has not started, start sessions
  */
 public static function init()
 {
     if (self::$sessionStarted == false) {
         session_start();
         self::$sessionStarted = true;
     }
 }
示例#2
0
 public static function checkSessionStarted()
 {
     if (self::$sessionStarted) {
         return true;
     }
     if (version_compare(PHP_VERSION, '5.4', '>=')) {
         if (PHP_SESSION_NONE === session_status()) {
             session_start();
         }
     } elseif (!session_id()) {
         session_start();
     }
     self::$sessionStarted = true;
     return self::$sessionStarted;
 }