首页 > 解决方案 > 在 Codeigniter 中创建备份 Zip 文件,但在 PhpmyAdmin 中导入此文件时,它不会导入

问题描述

此代码用于在 Codeigniter 中创建备份文件,但在 PhpmyAdmin 中导入此文件时,它不会导入。发生错误:

对于在字符串查询中插入记录不是单一法院

$this->load->dbutil();
$today = date('d-m-y-h-i-s');
$prefs = array(

    'format' => 'zip', // gzip, zip, txt
    'filename' => 'sujata.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 your entire database and assign it to a variable
$backup = $this->dbutil->backup($prefs);

// Load the file helper and write the file to your server
$this->load->helper('file');
$filename = 'backup/sujata-' . $today . '.zip';
write_file($filename, $backup);

标签: phpcodeigniterbackup

解决方案


推荐阅读