PHP uses the mysqldump command to export the database. PHP uses the mysqldump command to export the database. PHP uses the external command to export the database. the code is very simple, so there is not much nonsense. 123456789101112131415161718192021? Php $ d PHP use the mysqldump command to export the database
PHP uses external commands to export the database. the code is very simple, so there is not much nonsense.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
// $ DumpFileName $ DbHost = 'localhost '; $ DbUser = 'root '; $ DbPwd = '000000 '; $ 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 ); ?> |
PHP export the database using external commands. the code is very simple, so there is not much nonsense. 1 2 3 4 5 6 7 8 9 10 11 12 13 14 16 17 18 19 20 21? Php // $ d...