通过PHP / MySQL将应用程序数据导出到XML的最佳实践?

时间:2022-09-25 16:09:03

I have a business app and I want to give my users the ability to export their data at anytime.

我有一个商业应用程序,我希望让我的用户能够随时导出他们的数据。

I'm aware that I can write an XML file semi-manually by doing something like this: http://www.kirupa.com/web/mysql_xml_php.htm

我知道我可以通过这样的方式半手动编写XML文件:http://www.kirupa.com/web/mysql_xml_php.htm

But, I thought I'd ask if this is the best practice? Or is there some framework I can use to do this more easily/quickly? Maybe there isn't - it won't be too hard to do it the above way.

但是,我想我会问这是不是最好的做法?或者是否有一些框架可以用来更容易/更快地完成这项工作?也许没有 - 以上述方式做到这一点并不会太难。

Also, less importantly - XML is the best format to export to, right?

另外,不太重要的是 - XML是最好的导出格式,对吧?

Thanks in advance.

提前致谢。

4 个解决方案

#1


1  

I recommend having a look at the PEAR package XML_Query2XML.

我建议看一下PEAR包XML_Query2XML。

#2


1  

The best format to export your data largely depends on what kind of data you are exporting. For some datasets, a simple export to Comma Separated Value (CSV) files will be sufficient. If your data is more complex, there is a PEAR package that will serialize PHP values into XML objects.

导出数据的最佳格式在很大程度上取决于您导出的数据类型。对于某些数据集,只需导出到逗号分隔值(CSV)文件就足够了。如果您的数据更复杂,那么有一个PEAR包可以将PHP值序列化为XML对象。

This tutorial will show you how to use the various PEAR packages to take your existing data in PHP and convert it relatively easily to well structured XML:

本教程将向您展示如何使用各种PEAR包来获取PHP中的现有数据,并将其相对轻松地转换为结构良好的XML:

http://articles.sitepoint.com/article/xml-php-pear-xml_serializer

I would definitely recommend XML as an option for exporting your data as there are a vast number of tools and technologies that interact well with XML; XQuery, XSLT, etc.

我肯定会建议使用XML作为导出数据的选项,因为有大量的工具和技术可以与XML良好地交互; XQuery,XSLT等

#3


1  

there is no reason to reinvent the wheel, mysql already support selecting result into xml format since 5.1

没有理由重新发明*,mysql已经支持从5.1开始选择xml格式的结果

XML is the best format to export to, right?

XML是导出的最佳格式,对吗?

too subjective, some said yes, some said no ...

太主观了,有些人说是,有些人说不......

#4


0  

I would you php's DomDocument class. its really easy to use >> http://php.net/manual/en/class.domdocument.php

我想你php的DomDocument类。它真的很容易使用>> http://php.net/manual/en/class.domdocument.php

#1


1  

I recommend having a look at the PEAR package XML_Query2XML.

我建议看一下PEAR包XML_Query2XML。

#2


1  

The best format to export your data largely depends on what kind of data you are exporting. For some datasets, a simple export to Comma Separated Value (CSV) files will be sufficient. If your data is more complex, there is a PEAR package that will serialize PHP values into XML objects.

导出数据的最佳格式在很大程度上取决于您导出的数据类型。对于某些数据集,只需导出到逗号分隔值(CSV)文件就足够了。如果您的数据更复杂,那么有一个PEAR包可以将PHP值序列化为XML对象。

This tutorial will show you how to use the various PEAR packages to take your existing data in PHP and convert it relatively easily to well structured XML:

本教程将向您展示如何使用各种PEAR包来获取PHP中的现有数据,并将其相对轻松地转换为结构良好的XML:

http://articles.sitepoint.com/article/xml-php-pear-xml_serializer

I would definitely recommend XML as an option for exporting your data as there are a vast number of tools and technologies that interact well with XML; XQuery, XSLT, etc.

我肯定会建议使用XML作为导出数据的选项,因为有大量的工具和技术可以与XML良好地交互; XQuery,XSLT等

#3


1  

there is no reason to reinvent the wheel, mysql already support selecting result into xml format since 5.1

没有理由重新发明*,mysql已经支持从5.1开始选择xml格式的结果

XML is the best format to export to, right?

XML是导出的最佳格式,对吗?

too subjective, some said yes, some said no ...

太主观了,有些人说是,有些人说不......

#4


0  

I would you php's DomDocument class. its really easy to use >> http://php.net/manual/en/class.domdocument.php

我想你php的DomDocument类。它真的很容易使用>> http://php.net/manual/en/class.domdocument.php