PHP CSV导出超过20000条记录 [英] PHP CSV export more than 20000 records

查看:445
本文介绍了PHP CSV导出超过20000条记录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

内存分配的致命错误,用于查询从数据库读取超过20000条记录,以及花费太多时间加载



因此,请帮助我们以导出超过20000条记录。

解决方案

如果您将这么多记录导出为Excel,



如果您通过PHP脚本将数据导出到CSV,那么您可以使用以下



set_time_limit (6000);
ini_set(memory_limit,-1);



第一个将设置脚本限制,第二个将擦除内存问题。 >

但是它总是好的,以避免导出或导入与巨大的数据集,但我同意某些时候,我们别无选择,只要按照要求。


Giving Fatal Error in memory allocation for query reading more than 20000 records from the database and also its taking too much of time to load

So please help us good suggestion to export more than 20000 records.

解决方案

If you are exporting that many records as Excel then the issue will be more bad than memory limit.

If you are exporting data to CSV via the PHP script then you can use the following

set_time_limit(6000); ini_set("memory_limit", -1);

The first one will set the script limit and the 2nd one will erase the memory issue.

But its always good to avoid exporting or importing at once with huge data set, but I agree sometime we have no choice but to do as per the requirement.

这篇关于PHP CSV导出超过20000条记录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆