简体   繁体   English

CodeIgniter备份数据库无法正常工作

[英]CodeIgniter Backup Database is not working

I am using CodeIgniter Backup database utility class. 我正在使用CodeIgniter Backup数据库实用程序类。 But it is giving me an error of 但这给我一个错误

Unsupported feature of the database platform you are using. 您正在使用的数据库平台的不受支持的功能。

Filename: E:\\xampp\\htdocs\\zafarsir\\system\\database\\drivers\\mysqli\\mysqli_utility.php 文件名:E:\\ xampp \\ htdocs \\ zafarsir \\ system \\ database \\ drivers \\ mysqli \\ mysqli_utility.php

Line Number: 82 行号:82

Here is my code 这是我的代码

$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); 

It is giving me error on this line 这给我这条线上的错误

$backup =& $this->dbutil->backup();

I am new to CodeIgniter plz helpe me 我是CodeIgniter plz的新手

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); 
}

try this code, may be useful.... 试试这个代码,可能有用。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM