它需要在 ssh 会话中创建文件“index.php”。使用:“phpseclib/phpseclib”:“~2.0”,$ssh = new SSH2("192.168.138.5", 22);$ssh->login("user", "mypass");$ssh->write("cd /home/user/\n");$ssh->read('[prompt]');$ssh->exec("cat > index.php <<EOF<?phpinclude($_SERVER['DOCUMENT_ROOT'] . '/header.php');EOF\n");$ssh->disconnect();unset($ssh);但结果是:<?phpinclude(['DOCUMENT_ROOT'] . '/header.php');如何在 ssh 会话中将“$_SERVER”文本写入文件?
- 2 回答
- 0 关注
- 90 浏览
添加回答
举报
0/150
提交
取消