在php中的远程ftp服务器上压缩整个文件夹及其内容 [英] Compress whole folder and its content on a remote ftp server in php

查看:334
本文介绍了在php中的远程ftp服务器上压缩整个文件夹及其内容的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好;

我一直试图想出一种在两台服务器之间构建自动PHP传输系统的方法。



服务器A:只有ftp访问;服务器B:ftp访问并可以运行php脚本。



我想将服务器A中的所有文件复制到服务器B中的文件夹;



以下是我要做的事情:



1:函数compress_each_ftp_folder_or_file_in_ftp_Backups_folder();



2:函数删除each_ftp_folder_in_ftp_Backups_folder_after_successful_zipping();



3:函数download_each_archive_in_ftp_Backups_folder();



4:函数delete_each_archive_after_successful_download();



我已经为第2,3和4步编写了一些脚本,但在网络上找不到任何帮助我第1步的脚本;

我发现很多代码压缩本地服务器上的文件夹或文件,但是我找不到任何压缩远程ftp服务器上整个文件夹的脚本。



我认为现在是时候寻求帮助了。谢谢你的帮助。

Hi guys;
I've been trying to come up with a way to build an automated PHP transfer system between 2 servers.

Server A : only ftp access; server B : ftp access and can run php scripts.

I want to copy all file in server A to a folder in server B;

Here is what I am trying to do :

1: function compress_each_ftp_folder_or_file_in_ftp_Backups_folder();

2: function delete each_ftp_folder_in_ftp_Backups_folder_after_successful_zipping();

3: function download_each_archive_in_ftp_Backups_folder();

4: function delete_each_archive_after_successful_download();

I have written some scripts for step 2, 3 and 4 but nothing found on web that help me with step 1;
I found lot of codes to compress folders or files on local server, but I don't found any script that compress a whole folder on a remote ftp server.

I think it was the time to ask for a help. Thanks for helping me.

推荐答案

你可以使用ZipArchive类

请参阅php手册上的文档
you could use ZipArchive class
please see its doc on php manual


这篇关于在php中的远程ftp服务器上压缩整个文件夹及其内容的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆