PHPExcel导出数据量较大时内存溢出
TP框架:
类的开头引入了PHPExcel类库的文件
然后在方法里设置了存储缓存方式就ok了:
列入:
public function getDownLoad(){
//此处是设置缓存方式
$cacheMethod = PHPExcel_CachedObjectStorageFactory::cache_in_memory_gzip;
$cacheSettings = array();
PHPExcel_Settings::setCacheStorageMethod($cacheMethod,$cacheSettings);
/****此处是data数据*****/
$excelObj = new HelperPHPExcel();
$author = "Student";
$title = "学生信息".date("Y-m-d", $startTime)."至". date("Y-m-d", $endTime);
$excelObj->setCreator($author, $title);
$excelObj->downloadToExcel($title, $data, $cellTag);
声明:该文观点仅代表作者本人,入门客AI创业平台信息发布平台仅提供信息存储空间服务,如有疑问请联系rumenke@qq.com。
- 上一篇:没有了
- 下一篇: php编程: 怎样计算某一值在数组中重复出现的次数?