() La fonction PHP
Définition et utilisation
fonction ftp_exec () pour demander d'exécuter un programme ou une commande sur le serveur FTP.
En cas de succès, la fonction retourne TRUE. Si elle échoue, elle retourne FALSE.
grammaire
ftp_exec(ftp_connection,command)
参数 | 描述 |
---|---|
ftp_connection | 必需。规定要使用的 FTP 连接。 |
command | 必需。规定发送到 FTP 服务器的命令请求。 |
Trucs et astuces
NOTE: Avec la fonction de ftp_raw () est différent, ftp_exec () seulement après que vous vous connectez au serveur FTP pour envoyer des commandes.
Exemples
<?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);
?>
Remplissez PHP FTP Référence