欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

PHP ftp_nb_fget() 函數(shù)

定義和用法

ftp_nb_fget() 函數(shù)從 FTP 服務(wù)器上下載一個(gè)文件并保存到本地已經(jīng)打開的一個(gè)文件中 (non-blocking)。

該函數(shù)返回下列值:

  • FTP_FAILED (send/receive failed)
  • FTP_FINISHED (send/receive completed)
  • FTP_MOREDATA (send/receive in progress)

ftp_fget() 不同,該函數(shù)異步地獲取文件。這意味著您的程序可以在文件下載時(shí)執(zhí)行其他操作。

語法

ftp_nb_fget(ftp_connection,local,remote,mode,resume)
參數(shù) 描述
ftp_connection 必需。規(guī)定要使用的 FTP 連接(FTP 連接的標(biāo)識(shí)符)。
local 必需。規(guī)定本地文件。
remote 必需。規(guī)定從中進(jìn)行拷貝的文件的路徑。
mode

必需。規(guī)定傳輸模式?赡艿闹涤校

  • FTP_ASCII
  • FTP_BINARY
resume 必需。規(guī)定在遠(yuǎn)程文件中的何處開始拷貝。默認(rèn)是 0。

例子

本例把文本從 "source.txt" 拷貝到 "target.txt" 中:

<?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");

ftp_nb_fget($conn,$target,$source,FTP_ASCII);

ftp_close($conn);
?>