好得很程序员自学网

<tfoot draggable='sEl'></tfoot>

CodeIgniter框架备份数据库

导出txt格式:

// Load the DB utility class

$this->load->dbutil();

  

// Backup your entire database and assign it to a variable

$backup=&$this->dbutil->backup(array('format'=>'txt')); 

  

// Load the file helper and write the file to your server

$this->load->helper('file');

write_file('backup.sql',$backup);

 

gzip格式:

// 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('mybackup.gz',$backup);

 

zip格式

// Load the DB utility class

$this->load->dbutil();

  

// Backup your entire database and assign it to a variable

$backup=&$this->dbutil->backup(array('format'=>'zip')); 

  

// Load the file helper and write the file to your server

$this->load->helper('file');

write_file('backup.zip',$backup);

 

查看更多关于CodeIgniter框架备份数据库的详细内容...

  阅读:67次