简体   繁体   English

PHP将ExpressionEngine数据库查询导出到.txt文件

[英]php to export ExpressionEngine database query to .txt file

I am currently working on a project where I am looking at converting ExpressionEngine channel entries into individual .txt or .csv files. 我目前正在研究一个项目,该项目旨在将ExpressionEngine通道条目转换为单个.txt或.csv文件。 I can export all channel entries into one file, but I am struggling when it comes to separating each entry into individual files... 我可以将所有频道条目导出到一个文件中,但是在将每个条目分成单独的文件时我很费劲……

I am integrating the website with a clients stock inventory system for their retail stores. 我正在将该网站与客户的零售商店库存系统集成在一起。 The software inputs .txt or .csv files into the system when an order is placed in store, this then updates their stock inventory. 下订单时,软件会将.txt或.csv文件输入系统,然后更新其库存。

The website is going to display their products with live stock inventory based on in store orders and online orders. 该网站将根据店内订单和在线订单显示带有实时库存的产品。

I am looking into pulling data from each order via an sql query and exporting this as a .txt file. 我正在研究通过sql查询从每个订单中提取数据,并将其导出为.txt文件。 Each order will create an individual text file and once an hour the .txt files will be exported to a folder within the server via a cron. 每个订单将创建一个单独的文本文件,每小时将.txt文件通过cron导出到服务器内的文件夹中。 This is the folder the clients stock inventory system uploads the .txt files from. 这是客户库存清单系统从中上载.txt文件的文件夹。 so if an order is placed via the website, the file will be exported and uploaded to the stock system, reducing the stock inventory for that item buy the amount in the order. 因此,如果通过网站下订单,则文件将被导出并上传到库存系统,从而减少了该商品的库存,从而减少了订单中的金额。

Any suggestions or pointers would be appreciated. 任何建议或指示,将不胜感激。

If this is a complicated way of achieving this and anyone has a more simplified solution then please let me know. 如果这是实现此目标的复杂方法,并且任何人都拥有更简化的解决方案,那么请告诉我。

Thanks in advance 提前致谢

What module are you using for your e-commerce setup? 您正在使用哪个模块进行电子商务设置? Chances are it has an extension hook you could use that fires after each order is completed. 可能有一个扩展钩,您可以使用它在每个订单完成后触发。 You could add your code in that hook to export the order as a text file directly into the aforementioned folder on the server. 您可以在该挂钩中添加代码,以将订单作为文本文件直接导出到服务器上的上述文件夹中。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM