使用unix和mysql创建wordpress dump(.wxr)

Yah*_*-Me 7 mysql unix wordpress

我需要在我的服务器上使用SSH创建wordpress导出转储(.WXR).我无法访问Wordpress仪表板.可以使用一些unix,mysql脚本完成.

csi*_*ilk 4

正如此处的博客所示,您所需要的只是export_wp函数,因此请按照以下方式运行一些内容。

include 'wp-config.php';
include 'wp-admin/includes/export.php';

ob_start();
export_wp();
$file = ob_get_contents();
ob_end_clean();

$fh = fopen("wordpress-" . date('Y-m-d') . ".xml", 'w');
fwrite($fh, $file);
fclose($fh);
Run Code Online (Sandbox Code Playgroud)

然后只需获取生成的 .xml 文件即可!