phpseclib\Net\SSH2::disconnect PHP Method

disconnect() public method

Disconnect
public disconnect ( )
    function disconnect()
    {
        $this->_disconnect(NET_SSH2_DISCONNECT_BY_APPLICATION);
        if (isset($this->realtime_log_file) && is_resource($this->realtime_log_file)) {
            fclose($this->realtime_log_file);
        }
        unset(self::$connections[$this->getResourceId()]);
    }

Usage Example

Example #1
0
 /**
  * "Proper" disconnect
  */
 public function __destruct()
 {
     if ($this->ssh instanceof SSH2) {
         $this->ssh->disconnect();
     }
     if ($this->sftp instanceof SFTP) {
         $this->sftp->disconnect();
     }
 }