通过PHP将MySQL转换为XML

问题描述:

我的服务器上有一个MySQL数据库,我希望通过PHP以XML形式返回某个表.我已经看到了将XML转换为MySQL的各种方法,但是却没有一种容易遵循的相反方法.我应该如何去做?

I have a MySQL database on my server and I'd like a certain table to be returned via PHP as XML. I've seen various ways to get XML to MySQL, but not an easy to follow way of the opposite. How should I go about doing so?

只需拉出数据并将其手动形成XML文档(使用DOM或XMLWriter类),就没有内置的方法可以做到这一点.但是,如果您正在寻找预先构建的解决方案,则PHPMyAdmin可以将表转储到XML文档中.

Just pull the data out and manually form it into an XML document (using the DOM or XMLWriter classes), there's no built in way to just do it. If you're looking for a pre-built solution though, PHPMyAdmin has functionality to dump a table to an XML document.