PHP使用mysqldump命令导出数据库,phpmysqldump_PHP教程

WBOY
Release: 2016-07-13 09:57:12
Original
856 people have browsed it

PHP使用mysqldump命令导出数据库,phpmysqldump

PHP使用外部命令导出数据库,代码很简单,就不多废话了

<?php // $dumpFileName目录要有可写权限 $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); ?>
Copy after login

以上就是本文所述的全部内容了,希望大家能够喜欢。

www.bkjia.com true http://www.bkjia.com/PHPjc/984008.html TechArticle PHP使用mysqldump命令导出数据库,phpmysqldump PHP使用外部命令导出数据库,代码很简单,就不多废话了 php // $dumpFileName目录要有可写权限 $DbH...
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!