ssh2.shell:// ssh2.exec:// ssh2.tunnel:// ssh2.sftp:// ssh2.scp:// PHP 4.3.0 及以上版本 (PECL)
Note: 该封装器默认没有启用 要使用 ssh2.*:// 封装器,必须安装 » SSH2 扩展。可以到 » PECL 下载。
除了接受传统 URI 的登录信息外,ssh2 封装器也重用主机 URL 的一部分的连接资源。
Example#1 为活动连接打开流
<?php$session = ssh2_connect('example.com', 22);ssh2_auth_pubkey_file($session, 'username', '/home/username/.ssh/id_rsa.pub', '/home/username/.ssh/id_rsa', 'secret');$stream = fopen("ssh2.tunnel://$session/remote.example.com:1234", 'r');?>