ftp_exec() 函数请求在 FTP 服务器上执行一个程序或命令。
若成功(服务器发送响应代码 200),则返回 true,否则返回 false。
</>code
- ftp_exec(ftp_connection,command)
参数 | 描述 |
---|---|
ftp_connection | 必需。规定要使用的 FTP 连接(FTP 连接的标识符)。 |
command | 必需。规定发送到服务器的命名请求。 |
该函数发送一个 SITE EXEC command 请求到 FTP 服务器。
与 ftp_raw() 函数 不同,ftp_exec() 只有在登录到 FTP 服务器后才能发送命令。
</>code
- <?php
- $command = "ls-al > test.txt";
- $conn = ftp_connect("ftp.testftp.com") or die("Could not connect");
- ftp_login($conn,"admin","ert456");
- if (
ftp_exec($conn,$command)
)- {
- echo "Command executed successfully";
- }
- else
- {
- echo "Execution of command failed";
- }
- ftp_close($conn);
- ?>
如对本文有疑问,请提交到交流论坛,广大热心网友会为你解答!! 点击进入论坛
Powered by 365建站网 RSS地图 HTML地图
copyright © 2013-2024 版权所有 鄂ICP备17013400号