Business requirements sometimes require tens of thousands of items to be exported.
Can I use python to process it?? It’s too stuck.
What if I use python to process it?
伊谢尔伦2017-06-14 10:51:44
More than 10,000 items are not a lot. You can use the third-party library PHPExcel
. Or directly export csv
, function: fputcsv
.
三叔2017-06-14 10:51:44
Time-consuming server tasks like this should not be designed as Browser->Sync->Server
;
should be in the form of asynchronous tasks:
Browser: I want an Excel, please generate it for me first
Server: OK, the mission has started
Browser: Let me refresh it and see (you can use a long connection instead), it seems to be completed. Give me the URL (URL can be reflected in the task, no need to obtain it again), I want to download it
Server: http://domain.com/test.xlsx
Browser: Start download
学习ing2017-06-14 10:51:44
Isn’t it enough to have more than 10,000 entries? How big is the file?
三叔2017-06-14 10:51:44
You can make the generation segmented... write 1000 items in 1000 items.
In addition, if php times out, you can change set_time_limit()
为情所困2017-06-14 10:51:44
Use asynchronous or multi-process, the browser submits the task, prompting that the task is being processed, the background multi-process script slowly processes it, and when it is completed, it pushes a message to the browser to prompt the user that the export operation has been completed and can be downloaded.
Browser push message: http://www.workerman.net/web-...
Multi-process framework: http://doc3.workerman.net/ins...