与 ssh2_connect() 断开连接 [英] Disconnect from ssh2_connect()
本文介绍了与 ssh2_connect() 断开连接的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我已经使用 ssh2_connect
通过 ssh2 连接到服务器,但我没有看到任何方法 在联机帮助页中我应该如何结束连接.
I've connected over ssh2 using ssh2_connect
to a server, but I don't see any method in the manpages for how I should end the connection.
我不喜欢在断开连接之前等待脚本结束.
I'm not exactly a fan of waiting for a script to end before I disconnect.
我可以使用 fclose
吗?听起来不太对劲...
Can I use fclose
? That doesn't sound right...
推荐答案
Just unset($connection)
您的连接变量或 ssh2_exec($connection, 'exit');
可能会这样做.
Just unset($connection)
your connection variable or ssh2_exec($connection, 'exit');
might do it.
为了更有说服力,您可能会执行以下操作!
You could probably do the following in order to be even more convincing!
ssh2_exec($connection, 'exit');
unset($connection);
这篇关于与 ssh2_connect() 断开连接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文