当前位置: 首页 > 网络学院 > 服务端脚本教程 > PHP > ftp_nb_fput() 函数
The ftp_nb_fput() function uploads from an open file and saves it to a file on the FTP server.
ftp_nb_fput()函数的作用是:上传一个已经打开的文件到 FTP 服务器 (non-blocking)。
This function returns one of the following values:
这个函数包括的值如下:
Unlike ftp_fput(), this function retrieves the file asynchronously. This means your program can perform other operations while the file is being downloaded.
与ftp_fget()函数不同,这个函数对于文件的发送/获取是不同步的。它意味着:当文件正在下载时,你的程序可以运行其它操作,他们互不干扰。
ftp_nb_fput(ftp_connection,remote,local,mode,resume) |
Parameter 参数 | Description 描述 |
---|---|
ftp_connection | Required. Specifies the FTP connection to use 必要参数。指定需要连接的FTP |
remote | Required. Specifies the file to upload to 必要参数。指定需要复制的文件的路径 |
local | Required. Specifies the open file to upload from 必要参数。指定文件需要复制到的目标路径 |
mode | Required. Specifies the transfer mode. The possible values are: 必要参数。指定传输的模式:
|
resume | Optional. Specifies where in the local file to start copying. Default is 0 可选参数。指定从远程文件的哪个位置开始复制。默认值为0 |
This example copies the text from "source.txt" into "target.txt":
这个案例将“source.txt”的文本内容复制到“target”:
<?php $source = fopen("source.txt","r"); $conn = ftp_connect("ftp.testftp.com") or die("Could not connect"); ftp_login($conn,"admin","ert456"); ftp_nb_fput($conn,"target.txt",$source,FTP_ASCII); ftp_close($conn); ?> |