PHP ftp_nb_continue() 函数
定义和用法
ftp_nb_continue() funktionen fortsætter med at hente/sende filer.
Funktionen returnerer følgende værdier:
- FTP_FAILED (send/receive mislykkedes)
- FTP_FINISHED (send/receive fuldført)
- FTP_MOREDATA (send/receive i gang)
Denne funktion sender/kan hente filer asynkront. Dette betyder, at dit program kan udføre andre operationer, mens filen downloades.
Syntaks
ftp_nb_continue(ftp_connection)
Parameter | Beskrivelse |
---|---|
ftp_connection | Obligatorisk. Angiver den FTP-forbindelse, der skal bruges (FTP-forbindelsens identifikator). |
Eksempel
<?php $source = "source.txt"; $target = fopen("target.txt", "w"); $conn = ftp_connect("ftp.testftp.com") or die("Could not connect"); ftp_login($conn,"admin","ert456"); $status = ftp_nb_fget($conn,$source,$target,FTP_ASCII); while ($status == FTP_MOREDATA) { $status = ftp_nb_continue($conn); } if ($status != FTP_FINISHED) { echo "Download error"; } ftp_close($conn); ?>