php 通过 SSH 登录服务器的脚本

php script to login to a server through SSH

我有一个服务器,我通常只能在终端上使用命令 ssh 124.134.4.173 -l root 通过 ssh 访问
我如何使用 php 来获得相同的结果?

exec("ssh 124.134.4.173 -l root");或 shell_exec("ssh 124.134.4.173 -l root");会工作。