我正在使用CodeIgniter备份数据库实用程序类。 但它给了我一个错误
您正在使用的数据库平台不支持的功能。
文件名:E:\ xampp \ htdocs \ zafarsir \ system \ database \ drivers \ mysqli \ mysqli_utility.php
行号:82
这是我的代码
$this->load->dbutil();
// // Backup your entire database and assign it to a variable
$backup =& $this->dbutil->backup();
// Load the file helper and write the file to your server
$this->load->helper('file');
write_file('http://localhost/zafarsir/database/mybackup.gz', $backup);
// Load the download helper and send the file to your desktop
$this->load->helper('download');
force_download('mybackup.gz', $backup);
$prefs = array(
'tables' => array('user', 'party'), // Array of tables to backup.
'ignore' => array(), // List of tables to omit from the backup
'format' => 'txt', // gzip, zip, txt
'filename' => 'mybackup.sql', // File name - NEEDED ONLY WITH ZIP FILES
'add_drop' => TRUE, // Whether to add DROP TABLE statements to backup file
'add_insert' => TRUE, // Whether to add INSERT data to backup file
'newline' => "\n" // Newline character used in backup file
);
$this->dbutil->backup($prefs);
这条线给我错误
$backup =& $this->dbutil->backup();
我是CodeIgniter的新手plz helpe me
答案 0 :(得分:0)
function backup_Eventtable() {
$this->load->dbutil();
$prefs = array(
//'tables' => array('hotel_accomodation'), // Array of tables to backup.
'ignore' => array(), // List of tables to omit from the backup
'format' => 'txt', // gzip, zip, txt
'filename' => ''.date("Y-m-d-H-i-s").'-mybackup.sql', // File name - NEEDED ONLY WITH ZIP FILES
'add_drop' => TRUE, // Whether to add DROP TABLE statements to backup file
'add_insert' => TRUE, // Whether to add INSERT data to backup file
'newline' => "\n" // Newline character used in backup file
);
$backup =& $this->dbutil->backup($prefs);
//I tried it with and without the next 2 Lines.
$this->load->helper('file');
write_file('backup_db/'.date("Y-m-d-H-i-s").'-mybackup.sql', $backup);
}
试试这段代码,可能会有用....