PHP ftp_nb_fget() ວິທີການ

ການສະແດງດັ່ງນັ້ນ ແລະການນໍາໃຊ້

ftp_nb_fget() ວິທີການດາວນຳໄລຍະທີ່ບໍ່ຫວັງການດາວນຳຄືນວ່າບໍ່ສາມາດດາວນຳຈາກ FTP ບໍລິສັດໄປສະໜອງໃຫ້ບັນຊີທີ່ໄດ້ເປີດໄປແລ້ວ (non-blocking)

ຫົວວິທີຂອງພາສານນັ້ນກຳລັງກັບຄືນຄັນດັ່ງລາວ

  • FTP_FAILED (ການສົ່ງ/ຂຽນລົ້ມ)
  • FTP_FINISHED (send/receive completed)
  • FTP_MOREDATA (send/receive in progress)

With ftp_fget() Different, this function retrieves the file asynchronously. This means that your program can perform other operations while the file is being downloaded.

Syntax

ftp_nb_fget(ftp_connection,local,remote,mode,resume)
Parameters Description
ftp_connection Required. Specifies the FTP connection to use (identifier of the FTP connection).
local Required. Specifies the local file.
remote Required. Specifies the path of the file from which to copy.
mode

Required. Specifies the transmission mode. Possible values include:

  • FTP_ASCII
  • FTP_BINARY
resume Required. Specifies where to start copying in the remote file. The default is 0.

Example

This example copies text from "source.txt" to "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);
?>