且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

将mysql表导出为SQL格式?

更新时间:2023-11-30 20:05:40

不要重新发明***。您所需要的已经存在的几乎是现成的:

Do not reinvent the wheel. What you need already exists almost out-of-the-box:

<?php
    $result = exec("/path/to/mysqldump -u$username -p$password your_database your_table > /desired/output/path/dump.sql");

您可能想检查 $ result afterwads,以确保一切顺利。

You may want to check the contents of $result afterwads, to make sure everything went smooth.

此处的参考手册。