php - 在 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);
解决方案
推荐阅读
- r - 从具有不同变量名称的计数表创建比例函数
- c++ - 是否可以在编译时输出 constexpr 变量来调试模板元程序?
- android - 来自 Google Play 发布者/开发者 (Java) 的应用程序列表
- laravel - Laravel 从控制器中的方法返回视图
- python - 如何在 Amazon Linux 2 AMI EC2 上安装 Scrapy Docker 容器
- python-2.7 - 当文本从第 n 个位置开始时,如何仅读取文本文件中的行
- javascript - 使用 TypeScript 简化 JavaScript 代码
- php - 如何获得压缩字符串的“字节”大小?
- android - 如何使用协同程序以块的形式更新我的适配器(而不是一次全部更新)?
- python - Heroku 内部服务器错误 - ValueError: Invalid header value b