ThinkChat🤖让你学习和工作更高效,注册即送10W Token,即刻开启你的AI之旅 广告
# 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 ```