função PHP ftp_exec ()
Definição e Uso
função ftp_exec () para solicitar a execução de um programa ou comando no servidor FTP.
Se for bem sucedido, a função retorna TRUE. Se ele falhar, ele retorna FALSE.
gramática
ftp_exec(ftp_connection,command)
参数 | 描述 |
---|---|
ftp_connection | 必需。规定要使用的 FTP 连接。 |
command | 必需。规定发送到 FTP 服务器的命令请求。 |
Dicas e Notas
NOTA: Com a função ftp_raw () é diferente, ftp_exec () somente depois de iniciar sessão no servidor de FTP para enviar comandos.
Exemplos
<?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);
?>
Completar PHP FTP Referência