Home > php教程 > php手册 > body text

php备份数据库脚本的几个例子

WBOY
Release: 2016-05-25 16:38:19
Original
1047 people have browsed it

利用php备份mysql数据库就是把数据生成.sql文件,这样就算是数据备份成功了,恢复时也可以直接读取再一条条执行即可,下面整理了一些备份例子大家有兴趣的可进来参考.

例子,代码如下:

Copy after login

//例子,代码如下:

//!/usr/bin/php
 " . $sql_dir;
        system($execs);
        if (file_exists($sql_dir . '.gz')) {
            unlink($sql_dir . '.gz');
        }
        system('gzip ' . $sql_dir);
    }
}
Copy after login

//例子,代码如下:

create($filename);
if ($v_list == 0) {
    die("Error : " . $archive->errorInfo(true));
}
if (file_exists($filename)) {
    unlink($filename);
}
echo "Mysql's backup successfully to " . $filename . ".zip";
?>
Copy after login

Zip打包备份代码, 几乎就是全抄demo, 太方便了, 代码如下 :

create($src);  
if ($v_list == 0) {  
   die("Error : ".$archive->errorInfo(true));  
}else{  
     print("Success");  
}  
?>
Copy after login

pclzip.lib.php这个压缩包文件大家百度去下载这里未提供 . 


文章地址:

转载随意^^请带上本文地址!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!