fonction ftp_get PHP ()
Définition et utilisation
fonction ftp_get () pour télécharger un fichier à partir du serveur FTP et l'enregistre dans un fichier.
En cas de succès, la fonction retourne TRUE. Si elle échoue, elle retourne FALSE.
grammaire
ftp_get(ftp_connection,local,remote,mode,resume)
参数 | 描述 |
---|---|
ftp_connection | 必需。规定要使用的 FTP 连接。 |
local | 必需。规定要保存内容的本地一个文件。如果文件已存在,则被覆盖。 |
remote | 必需。规定从中复制内容的文件的路径。 |
mode | 必需。规定传输模式。可能的值有:
|
resume | 可选。规定在远程文件中的何处开始复制。默认是 0。 |
Exemples
Cet exemple est copié à partir du "source.txt" texte "target.txt" à:
<?php
$conn = ftp_connect("ftp.testftp.com") or die("Could not connect");
ftp_login($conn,"admin","ert456");
echo ftp_get($conn,"target.txt","source.txt",FTP_ASCII);
ftp_close($conn);
?>
$conn = ftp_connect("ftp.testftp.com") or die("Could not connect");
ftp_login($conn,"admin","ert456");
echo ftp_get($conn,"target.txt","source.txt",FTP_ASCII);
ftp_close($conn);
?>
Le code ci-dessus va afficher:
1
Remplissez PHP FTP Référence