我正在为 PHP 中的数据库备份创建一个脚本。它现在正在工作。我的问题是如何更改备份目录?
这是代码:
<form action = '' method = 'POST'>
<input type = 'submit' name = "backup" value="Backup">
</form>
<?php
$host = 'localhost';
$user = 'root';
$pass = ' ';
$dbname = 'itravel';
$backup_name = "mybackup.sql";
if(isset($_POST['backup']))
{
$backup = "c:/xampp/mysql/bin/mysqldump --opt -h $host -u $user $dbname > $backup_name";
system($backup);
}
?>