When exporting an excel file in php, the excel file times out due to a large amount of data.

Source: Internet
Author: User
It takes a long time to obtain 8000 records from the database and output the records to excel. It should have exceeded the limit of 30 seconds for webpage requests. In this way, data cannot be printed if there are more than one data record? Solution: 1. set_time_limit (0); 2. ob_flush (); flush (); another question: time and memory are simultaneously affected... it takes a long time to obtain 8000 records from the database and output the records to excel. It should have exceeded the limit of 30 seconds for webpage requests. In this way, data cannot be printed if there are more than one data record?
Solution:
1. set_time_limit (0 );
2. ob_flush ();
Flush ();
I will also ask: does the time and memory affect the print output of exel at the same time?

Reply content:

It takes a long time to obtain 8000 records from the database and output the records to excel. It should have exceeded the limit of 30 seconds for webpage requests. In this way, data cannot be printed if there are more than one data record?
Solution:
1. set_time_limit (0 );
2. ob_flush ();
Flush ();
I will also ask: does the time and memory affect the print output of exel at the same time?

Hope to help you: http://www.jianshu.com/p/6d8a99621e8b

You can addSet_time_limit (0 );In order to achieve the goal of not limiting the timeout time

You can use phpexcel to export data.

You need to compress the output content gzip to reduce the amount of content transmitted from the server to the browser.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.