导入多个xml文件
如果可能的话,我在这里寻求一些建议。
我基本上有 12 个 XML 文件,需要在 mysql 数据库中使用。这些xml文件的结构完全不同,并且数据不断变化。
考虑到这一点,引入、使用和更新它的最佳方法是什么。我曾想过使用 cronjob 来执行 php 文件,将每个文件写入自己的表中,但请记住,有 12 个文件,每个文件中约有 60 行,并且 cron 作业需要每 15 分钟运行一次认为这最终会杀死服务器。
任何有关解决方案的想法将不胜感激。
谢谢
理查德
I'm after a bit of advice here if possible.
I basically have 12 XML files which I need to use in my mysql db. These xml files are all in a completely different structure and the data changes constantly.
With this in mind what would be the best approach for bringing this in and using it and updating it. I had thought to use a cronjob to execute a php file to write each of these into thier own table, but baring in mind there are 12 files, with around 60 lines in each file and the cron job will need to run every 15 minutes I think this will end up killing the server.
Any ideas on a solution would be gratefully appreciated.
Thanks
Richard
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以使用 mysql 中的 LOAD_XML 命令来执行此操作:
http://dev.mysql.com/doc/refman/5.5 /en/load-xml.html
如果 XML 文件中的数据不断更改,那么数据库中的数据多久需要更新一次?如果数据库只是 XML 的后备记录,那么也许您可以每小时更新一次或两次。
You can use the LOAD_XML command in mysql to do this:
http://dev.mysql.com/doc/refman/5.5/en/load-xml.html
If the data is changed constantly in the XML files, how often does it need to be up to date in the database? If the database is just a backing record for the XML, then maybe you can update once or twice an hour.