PHP ftp_get() 函数

PHP 教程 · 2019-01-26 08:44:23

定义和用法

ftp_get() 函数从 FTP 服务器上下载一个文件并保存到本地一个文件中。

如果成功,该函数返回 TRUE。如果失败,则返回 FALSE。

语法


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


参数 描述
ftp_connection 必需。规定要使用的 FTP 连接。
local 必需。规定要保存内容的本地一个文件。如果文件已存在,则被覆盖。
remote 必需。规定从中复制内容的文件的路径。
mode 必需。规定传输模式。可能的值有:
  • FTP_ASCII
  • FTP_BINARY
resume 可选。规定在远程文件中的何处开始复制。默认是 0。

实例

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


<?php
$conn = ftp_connect("ftp.testftp.com") or die("Could not connect");
ftp_login($conn,"admin","ert456");
echo ftp_get($conn,"target.txt","source.txt",FTP_ASCII);
ftp_close($conn);
?> 

上面的代码将输出:


1


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

查看所有标签

Graph Algorithms

Graph Algorithms

Shimon Even / Cambridge University Press / 2011-9-19 / USD 32.99

Shimon Even's Graph Algorithms, published in 1979, was a seminal introductory book on algorithms read by everyone engaged in the field. This thoroughly revised second edition, with a foreword by Richa......一起来看看 《Graph Algorithms》 这本书的介绍吧!

MD5 加密
MD5 加密

MD5 加密工具

XML、JSON 在线转换
XML、JSON 在线转换

在线XML、JSON转换工具

RGB CMYK 转换工具
RGB CMYK 转换工具

RGB CMYK 互转工具