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

查看所有标签

Modeling the Internet and the Web

Modeling the Internet and the Web

Pierre Baldi、Paolo Frasconi、Padhraic Smyth / Wiley / 2003-7-7 / USD 115.00

Modeling the Internet and the Web covers the most important aspects of modeling the Web using a modern mathematical and probabilistic treatment. It focuses on the information and application layers, a......一起来看看 《Modeling the Internet and the Web》 这本书的介绍吧!

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

在线图片转Base64编码工具

RGB HSV 转换
RGB HSV 转换

RGB HSV 互转工具

HEX CMYK 转换工具
HEX CMYK 转换工具

HEX CMYK 互转工具