función de PHP ftp_exec ()
Definición y Uso
ftp_exec función () para solicitar para ejecutar un programa o comando en el servidor FTP.
Si tiene éxito, la función devuelve TRUE. Si se produce un error, devuelve FALSO.
gramática
ftp_exec(ftp_connection,command)
参数 | 描述 |
---|---|
ftp_connection | 必需。规定要使用的 FTP 连接。 |
command | 必需。规定发送到 FTP 服务器的命令请求。 |
Notas y sugerencias
NOTA: Con la función ftp_raw () es diferente, ftp_exec () sólo después de que inicie sesión en el servidor FTP para enviar comandos.
Ejemplos
<?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 Referencia