遇到的问题: 少量数据可以导出excel, 但数据量大时,导出报错(地址更改)。 解决办法: (内存溢出) 函数里面添加如下代码: $objPHPExcel = new PHPExcel(); ini_set("memory_limit", "1024M"); // 设置php可使用内存 // 设置缓存方式,减少对内存的占用 $cacheMethod = PHPExcel_CachedObjectStorageFactory::cache_to_phpTemp; $cacheSettings = array ( 'cacheTime' => 300 ); PHPExcel_Settings::setCacheStorageMethod ( $cacheMethod, $cacheSettings );
导出excel 报错的常见问题: https://blog.youkuaiyun.com/Drug_/article/details/78716358