小编mut*_*ebm的帖子

使用CodeIgniter备份MySQL数据库

我一直在研究CodeIgniter附带的用户指南.我对这个dbutil()方法很感兴趣.特别是以下代码行:

// Load the DB utility class
$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('/path/to/mybackup.gz', $backup); 

// Load the download helper and send the file to your desktop
$this->load->helper('download');
force_download('mybackup.gz', $backup); 
Run Code Online (Sandbox Code Playgroud)

它应该备份当前加载的MySQL数据库.但不幸的是,它不起作用,我收到以下消息:

遇到PHP错误

严重性:注意

消息:未定义的属性:CI_Loader :: $ dbutil

文件名:views/view.php

行号:10

致命错误:在第10行的C:\ xampp\htdocs\CodeIgniter\application\views\view.php中的非对象上调用成员函数backup()

我在这里错过了什么?任何帮助将非常感激.

php mysql database codeigniter

9
推荐指数
3
解决办法
3万
查看次数

标签 统计

codeigniter ×1

database ×1

mysql ×1

php ×1