0
如何在php中调用ssh2_exec函数来执行远程服务器中的命令,而不用硬编码我的服务器密码?ssh2_exec密码加密
下面是PHP手册参考:
<?php
$connection = ssh2_connect('shell.example.com', 22);
ssh2_auth_password($connection, 'myusername', 'mypasswordisvisibleforeveryone');
$stream = ssh2_exec($connection, '/usr/local/bin/php -i');
?>
你也可以做'ssh2_auth_password($ connection,'myusername',$ _REQUEST ['password'])''。 – neubert