博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
php用ftp协议传送文件_使用PHP通过FTP发送文件
阅读量:2513 次
发布时间:2019-05-11

本文共 1139 字,大约阅读时间需要 3 分钟。

php用ftp协议传送文件

Sending files to a server via FTP is an essential ability of any web developer or designer. Of course, we all use glossy FTP clients like WS_FTP and FireFTP, but what about FTP automation? You can use PHP to FTP files from one server to another. Let me show you how.

通过FTP将文件发送到服务器是任何Web开发人员或设计人员的基本能力。 当然,我们都使用像WS_FTP和FireFTP这样的有光泽的FTP客户端,但是FTP自动化又如何呢? 您可以使用PHP将FTP文件从一台服务器传输到另一台服务器。 让我告诉你怎么做。

PHP (The PHP)

$connection = ftp_connect($server);$login = ftp_login($connection, $ftp_user_name, $ftp_user_pass);if (!$connection || !$login) { die('Connection attempt failed!'); }$upload = ftp_put($connection, $dest, $source, $mode);if (!$upload) { echo 'FTP upload failed!'; }ftp_close($connection);

Obviously, the first task is to connect to the other server. Once the connection is created, you pass the login credentials. Once you're logged in, you can use the ftp_put() function to send the file. That's it!

显然,第一个任务是连接到其他服务器。 创建连接后,您将传递登录凭据。 登录后,可以使用ftp_put()函数发送文件。 而已!

What would you use this for? Well, you could set up a cron to and send it to an offsite server.

您将用它做什么? 好了,您可以设置一个cron来并将其发送到非现场服务器。

翻译自:

php用ftp协议传送文件

转载地址:http://zrswd.baihongyu.com/

你可能感兴趣的文章
利用golang语法检查对象是否实现了接口
查看>>
在UBUNTU上安装基于bochs的 xv6
查看>>
Azure Storage Blob文件重命名
查看>>
RxJava2.0 使用
查看>>
FreeImage的图像处理软件
查看>>
ASP.NET MVC开发必看系列
查看>>
点到平面的距离
查看>>
linux下安装FTP
查看>>
第四周编程总结
查看>>
《第12章 类的无参方法》
查看>>
经典机器学习算法系列7-svd
查看>>
mxnet系列 全连接层代码阅读
查看>>
0715
查看>>
Android开发进度06
查看>>
Beautiful Soup 中文文档
查看>>
USB各种模式 解释
查看>>
数据访问-----ADO.NET 小结和练习
查看>>
Linux lsof详解
查看>>
子组件给父组件传数据
查看>>
unix/linux下的共享内存、信号量、队列信息管理
查看>>