PHP ftp_put() 函数

PHP 教程 · 2019-01-26 11:27:56

定义和用法

ftp_put() 函数上传本地一个文件到 FTP 服务器上。

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

语法


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


参数 描述
ftp_connection 必需。规定要使用的 FTP 连接。
remote 必需。规定上传到 FTP 服务器上保存的文件。
local 必需。规定要上传的文件的路径。
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_put($conn,"target.txt","source.txt",FTP_ASCII);
ftp_close($conn);
?> 

上面的代码将输出:


1


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

查看所有标签

Web Security Testing Cookbook

Web Security Testing Cookbook

Paco Hope、Ben Walther / O'Reilly Media / 2008-10-24 / USD 39.99

Among the tests you perform on web applications, security testing is perhaps the most important, yet it's often the most neglected. The recipes in the Web Security Testing Cookbook demonstrate how dev......一起来看看 《Web Security Testing Cookbook》 这本书的介绍吧!

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

在线压缩/解压 HTML 代码

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

在线图片转Base64编码工具

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

RGB CMYK 互转工具