PHP ftp_nb_continue() 函數(shù)
PHP ftp_nb_continue() 函數(shù)

定義和用法
ftp_nb_continue() 函數(shù)連續(xù)獲取/發(fā)送文件。(無阻塞)
該函數(shù)返回下列值之一:
- FTP_FAILED(發(fā)送/獲取失敗)
- FTP_FINISHED(發(fā)送/獲取成功)
- FTP_MOREDATA(發(fā)送/獲取正在進行中)
該函數(shù)異步地發(fā)送/獲取文件。這意味著您的程序可以在文件下載時執(zhí)行其他操作。
語法
ftp_nb_continue(ftp_connection)
參數(shù) | 描述 |
---|---|
ftp_connection | 必需。規(guī)定要使用的 FTP 連接。 |
實例
<?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);
?>

相關(guān)文章
- PHP 數(shù)據(jù)類型
- PHP 運算符
- PHP 包含文件 include 和 require 語句
- PHP array_filter() 函數(shù)
- PHP array_intersect_uassoc() 函數(shù)
- PHP array_merge() 函數(shù)
- PHP array_multisort() 函數(shù)
- PHP array_rand() 函數(shù)
- PHP array_reduce() 函數(shù)
- PHP array_uintersect_assoc() 函數(shù)
- PHP array_values() 函數(shù)
- PHP current() 函數(shù)
- PHP extract() 函數(shù)
- PHP prev() 函數(shù)
- PHP rsort() 函數(shù)
- PHP uasort() 函數(shù)
- PHP 5 Array 函數(shù)
- PHP cURL 函數(shù)
- PHP FTP 函數(shù)
- PHP HTTP 函數(shù)