PHP uses the mysqldump command to export the database, Phpmysqldump
PHP uses external commands to export the database, the code is very simple, there is no more nonsense
<?php //$dumpFileName directory to have writable permission $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); ? >
The above is the whole content of this article, I hope you can enjoy.
http://www.bkjia.com/PHPjc/984008.html www.bkjia.com true http://www.bkjia.com/PHPjc/984008.html techarticle PHP using the mysqldump command to export the database, phpmysqldump PHP using external commands to export the database, the code is very simple, there is no more nonsense PHP//$dumpFileName directory to have writable permissions $DbH ...