我在backup.php文件里面是这样写的,完全从网上摘的,但路径改过了。然后是备份成功了,生成了一个.rar的压缩数据库文件,我解压来之后,出来一个跟数据库同名的.sql的文件,查看文件里面没有任何的数据,不知道哪里出了问题了。
<?php
if ($argc != 2 || in_array($argv[1], array('--help', '-?'))) {
?>
backup Ver 0.01, for Win95/Win98/WinNT/Win2000/WinXP on i32
Copyright (C) 2000 ptker All rights reserved.
This is free software,and you are welcome to modify and redistribute it
under the GPL license
PHP Shell script for the backup MySQL database.
Usage: <?php echo $argv[0]; ?> <option>
<option> can be database name you would like to backup.
With the --help, or -? options, you can get this help and exit.
<?php
} else {
$dbname = $argv[1];
$dump_tool = "F:\\wamp\\bin\\mysql\\mysql5.1.36\\bin\\mysqldump";
$rar_tool = "F:\\wamp\\bin\\php\\php5.3.0\\Rar";
@exec("$dump_tool --opt -u user -ppassword $dbname > ./$dbname.sql");
@exec("$rar_tool a -ag_yyyy_mm_dd_hh_mm $dbname.rar $dbname.sql");
@unlink("$dbname.sql");
echo "Backup complete!";
}
?>
自己解决了。。。