Excel download stuck 188kb

后端 未结 1 2038
别那么骄傲
别那么骄傲 2021-01-24 07:13

Hi I am exporting my mysql data in excel format currently I have 14k+ records but the problem is it stuck @188kb but when I tried trimming down the result to 100 records it does

相关标签:
1条回答
  • 2021-01-24 07:26

    This is only a wild guess but you may need to calculate the document size ahead of time and set a "Content-length" header

    header("Content-length: " . strlen($document));
    

    You will have to store your output in a string so you can calculate the length (output buffering might help capture your usage of xlsWriteLabel)

    ob_start();
    xlsBOF();
    xlsWriteLabel();
    // etc etc
    xlsEOF();
    $document = ob_get_contents();
    ob_end_clean();
    header("Content-length: " . strlen($document));
    echo $document;
    exit();
    
    0 讨论(0)
提交回复
热议问题