PHP 中的 ftp_exec() 函数
ftp_exec() 函数用于在 FTP 服务器上执行命令。
语法
ftp_exec(con, command)
参数
con − FTP 连接
command − 要执行的命令。
返回值
如果命令执行成功,ftp_exec() 函数返回 TRUE;否则,返回 FALSE。
示例
以下是一个在 FTP 服务器上执行命令的示例 −
<?php
$ftp_server="192.168.0.4";
$ftp_user="amit";
$ftp_pass="tywg61gh";
$con = ftp_connect($ftp_server) or die("Could not connect to $ftp_server");
// list all the files of the remote directory
$command = 'ls';
// execute command
if (ftp_exec($con,$command)) {
echo "Executed successfully!";
} else {
echo "Execution failed!";
}
ftp_close($con);
?>
广告
数据结构
网络
RDBMS
操作系统
Java
iOS
HTML
CSS
Android
Python
C 编程
C++
C#
MongoDB
MySQL
Javascript
PHP