php - How to split large batches of data?
女神的闺蜜爱上我
女神的闺蜜爱上我 2017-06-24 09:41:39
0
2
1003

Hello everyone, there are 10,000 orders in the database, and various calculations need to be performed on the orders every day. The language used is php mysql. Because so much order data was not considered in the previous design, I used a very conventional method of writing and updating all the data to the database and then returning the results. As a result, the checkout process is now stuck on that page, and it takes a long time to complete. Sometimes PHP times out and returns a blank page. Is there any way to prevent PHP from timing out?

Is it possible to divide the order into a group of 100 for processing?

How to achieve this kind of processing of a group of 100, wait a few seconds, and process the next group?

thank you all!

女神的闺蜜爱上我
女神的闺蜜爱上我

reply all(2)
Peter_Zhu

It is recommended to run batch calculations asynchronously in the background, store the results, and then read the results on the front end

Peter_Zhu

set_time_limit(0);//防止超时

为订单加上个status位标记是否已经处理,开启后台进程定时跑订单任务
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template