PHP ftp_nb_fput() 函数

PHP 教程 · 2019-01-26 10:13:41

定义和用法

ftp_nb_fput() 函数上传本地一个已经打开的文件,并在 FTP 服务器上把它保存为一个文件。(无阻塞)

该函数返回下列值之一:

  • FTP_FAILED(发送/获取失败)
  • FTP_FINISHED(发送/获取成功)
  • FTP_MOREDATA(发送/获取正在进行中)

与 ftp_fput() 不同,该函数异步地获取文件。这意味着您的程序可以在文件下载时执行其他操作。

语法


ftp_nb_fput(ftp_connection,remote,local,mode,resume)


参数 描述
ftp_connection 必需。规定要使用的 FTP 连接。
remote 必需。规定上传到 FTP 服务器上保存的文件。
local 必需。规定要上传的打开文件。
mode 必需。规定传输模式。可能的值:
  • FTP_ASCII
  • FTP_BINARY
resume 可选。规定在本地文件中的何处开始复制。默认是 0。

实例

本实例从 "source.txt" 中复制文本到 "target.txt" 中:


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


点击查看所有 PHP 教程 文章: https://www.codercto.com/courses/l/5.html

查看所有标签

Introduction to Graph Theory

Introduction to Graph Theory

Douglas B. West / Prentice Hall / 2000-9-1 / USD 140.00

For undergraduate or graduate courses in Graph Theory in departments of mathematics or computer science. This text offers a comprehensive and coherent introduction to the fundamental topics of graph ......一起来看看 《Introduction to Graph Theory》 这本书的介绍吧!

HTML 压缩/解压工具
HTML 压缩/解压工具

在线压缩/解压 HTML 代码

JSON 在线解析
JSON 在线解析

在线 JSON 格式化工具

HEX HSV 转换工具
HEX HSV 转换工具

HEX HSV 互换工具