PHP ftp_fget() 函数

PHP 教程 · 2019-01-26 07:56:50

定义和用法

ftp_fget() 函数从 FTP 服务器上下载一个文件并保存到本地一个已经打开的文件中。

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

语法


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


参数 描述
ftp_connection 必需。规定要使用的 FTP 连接。
local 必需。规定要保存内容的本地一个已经打开的文件。
remote 必需。规定从中复制内容的文件的路径。
mode 必需。规定传输模式。可能的值:
  • FTP_ASCII
  • FTP_BINARY
resume 可选。规定在远程文件中的何处开始复制。默认是 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_fget($conn,$target,$source,FTP_ASCII);
ftp_close($conn);
?> 


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

查看所有标签

Introduction to Computation and Programming Using Python

Introduction to Computation and Programming Using Python

John V. Guttag / The MIT Press / 2013-7 / USD 25.00

This book introduces students with little or no prior programming experience to the art of computational problem solving using Python and various Python libraries, including PyLab. It provides student......一起来看看 《Introduction to Computation and Programming Using Python》 这本书的介绍吧!

CSS 压缩/解压工具
CSS 压缩/解压工具

在线压缩/解压 CSS 代码

图片转BASE64编码
图片转BASE64编码

在线图片转Base64编码工具

Markdown 在线编辑器
Markdown 在线编辑器

Markdown 在线编辑器