PHP ftp_exec()関数
定義と使用法
ftp_exec()関数は、FTPサーバー上のプログラムやコマンドを実行するために要求します。
成功した場合、この関数はTRUEを返します。 それが失敗した場合は、FALSEを返します。
文法
ftp_exec(ftp_connection,command)
参数 | 描述 |
---|---|
ftp_connection | 必需。规定要使用的 FTP 连接。 |
command | 必需。规定发送到 FTP 服务器的命令请求。 |
ヒントと注意事項
注:ftp_raw付()関数を使用すると、コマンドを送信するFTPサーバにログインした後にのみ、異なるftp_exec()。
例
<?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);
?>
$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);
?>
PHP FTPリファレンスを完了