PHP uses the mysqldump command to export the database
PHP uses external commands to export the database, the code is very simple, there is no more nonsense
1 2 3 4 5 6 7 8 9 Ten + + / / / + |
!--? php /p> //$dumpFileName directory to have writable permissions $DbHost = ' localhost '; $DbUser = ' root '; $DbPwd = ' 123456 '; $DbName = ' a '; $fileName = $DbName. ' _mysql_data_backup_ '. Date (' Ymdhis). '. sql '; $dumpFileName = "/var/$fileName"; Header ("content-disposition:attachment; Filename= ". $fileName); Header ("Content-type:application/octet-stream"); Header ("Pragma:no-cache"); Header ("expires:0"); Echo ' mysqldump-h $DbHost-u$dbuser-p$dbpwd $DbName > $dumpFileName '; $hd = fopen ($dumpFileName, ' RB '); Echo fread ($HD, FileSize ($dumpFileName)); Fclose ($HD); ? |
http://www.bkjia.com/PHPjc/983321.html www.bkjia.com true http://www.bkjia.com/PHPjc/983321.html techarticle PHP uses the mysqldump command to export the database PHP uses external commands to export the database, the code is very simple, there is no more nonsense. 1 2 3 4 5 6 7 8 9 | php//$d ... /c5>