think\Session::destroy PHP Method

destroy() public static method

销毁session
public static destroy ( ) : void
return void
    public static function destroy()
    {
        if (!empty($_SESSION)) {
            $_SESSION = [];
        }
        session_unset();
        session_destroy();
        self::$init = null;
    }

Usage Example

Ejemplo n.º 1
0
 /**
  * @covers think\Session::destroy
  *
  * @todo Implement testDestroy().
  */
 public function testDestroy()
 {
     \think\Session::set('sessionnamedestroy', 'sessionvalue');
     \think\Session::destroy();
     $this->assertEmpty($_SESSION['sessionnamedestroy']);
 }