您现在的位置是:首页 > PHP函数

李清波 2021-06-17 PHP函数 1682 复制当前网址

ftp_get



PHP ftp_get() 函数

定义和用法

ftp_get() 函数从 FTP 服务器上下载一个文件。

若成功则返回 true,失败则返回 false。


语法

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


参数描述
ftp_connection必需。规定要使用的 FTP 连接(FTP 连接的标识符)。
local必需。规定本地文件。
remote必需。规定从中进行拷贝的文件的路径。
mode必需。规定传输模式。可能的值有:
  • FTP_ASCII

  • FTP_BINARY

resume必需。规定在远程文件中的何处开始拷贝。默认是 0。


说明

参数 resume 仅适用于 PHP 4.3.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


文章来源:http://liqingbo.com/blog-664.html

上一篇:ftp_login

下一篇:ftp_get_option

评论