On the Internet to find a database backup class, but do not know how to use, ask for answers
Original article Address: http://blog.csdn.net/j_bing/article/details/23124475
Can you tell me how to quote this class? Do not know how to swallow Ah!
/**
file:dbbackup.class.php
Database backup class file, the backup file is placed in the/backup directory
Package:sql
*/
Date_default_timezone_set (' PRC '); Setting the time zone
Class Dbbackup {
Private $path = "sql/backup/"; SQL file save path, default is/backup
Private $database; The name of the database that you want to back up
Private $size; Sub-volume sub-parts size
Private $fileName; SQL file name
Private $ds = "\ n"; Line break
Private $sqlEnd = ";"; End symbol for each SQL statement
/**
* Constructor method, used to instantiate the Backup class object
[email protected] string $database database name, the default value is ' Lighting '
[email protected] int $size the size of the volume file, the default value is 2048
*/
function __construct ($size = 2048, $database = ' lighting ') {
$this->database = $database; Set the database to be backed up, default to lighting
$this->size = $size; Sub-volume file size, default is 2MB
$this->filename = Date (' Ymdhis '). " _all ";
Ob_end_flush (); Clear all Caches
}
/**
* Common method for database backup
[EMAIL protected] BOOL whether the backup was successful
*/
Public Function Backup () {
$sqlFile = "; Preparing information for writing to the database
$this->showmess ("Backing Up");
/* Back up all data tables in the specified database */
if ($tables = mysql_query ("SHOW TABLE STATUS from". $this->database)) {