php备份网站程序,使用PHP备份整个网站

使用PHP,我正在开发一个CMS。这需要支持网站备份。

务必:

压缩的ZIP文件夹

必须至少在Linux和Windows上工作

必须在PHP 5.0上工作,PHP 4会很好

我只需要一个函数/类,不要链接我的开源软件,因为我需要自己做这件事

由于CMS支持XML,所以CMS不需要MySQL备份

我已经在PHP中检入ZipArchive。这是我迄今为止所做的。但是,当我尝试去它所创建的服务器上的ZIP文件时,我得到一个404?它不工作,我不知道为什么。

$filename = CONTENT_DIR . 'backups/' . date( 'm-d-Y_H-i-s' ) . '.zip';

if ( $handle = opendir( ABS_PATH ) ) {

$zip = new ZipArchive();

if ( $zip->open( $filename, ZIPARCHIVE::CREATE ) !== true ) {

exit( "cannot open \n" );

}

$string = '';

while ( ( $file = readdir( $handle ) ) !== false ) {

$zip->addFile( $file );

$string .= "$file\n
";

}

closedir( $handle );

$string .= "Status of the Zip Archive: " . $zip->status;

$string .= "
System status of the Zip Archive: " . $zip->statusSys;

$string .= "
Number of files in archive: " . $zip->numFiles;

$string .= "
File name in the file system: " . $zip->filename;

$string .= "
Comment for the archive: " . $zip->comment;

$zip->close();

echo $string;

}

?>

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值