【发布时间】:2012-12-21 10:51:32
【问题描述】:
我尝试在远程主机上打开一个文件并读取它,但我得到的返回值为 1。 也许有人发现了我的错误。
public function get()
{
return $stream = file_get_contents("ssh2.sftp".$this->connection."/home/user/logfile.txt");
}
$this->连接是:
public function __construct($host , $port , $user , $pass )
{
if(!$this->connection = ssh2_connect($host, $port)) return -1;
if(ssh2_auth_password( $this->connection, $user, $pass )) return -1;
return 1;
}
连接也可以,可以发送其他命令,例如 tar ...
【问题讨论】: