PHP ftp_nb_continue () function
![PHP FTP Reference](/images/up.gif)
Definition and Usage
ftp_nb_continue () function continuously retrieving / sending a file. (Non-blocking)
The function returns one of the following values:
- FTP_FAILED (transmission / acquisition failure)
- FTP_FINISHED (transmission / acquisition success)
- FTP_MOREDATA (send / get underway)
This function asynchronously send / retrieve files. This means that your program can perform other operations in the file download.
grammar
ftp_nb_continue(ftp_connection)
参数 | 描述 |
---|---|
ftp_connection | 必需。规定要使用的 FTP 连接。 |
Examples
<?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);
?>
$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);
?>
![PHP FTP Reference](/images/up.gif)