phpExcel如何将设置传递给类
发布时间:2020-12-13 22:05:02 所属栏目:PHP教程 来源:网络整理
导读:基本上我试图启用单元格缓存由于内存问题(不断耗尽)其相当大的speadsheet.从我在网上看到的细胞缓存是一个很好的方法 从我在网上找到的例子看起来像这样 Cell caching and memory leak stackoverflow – fix memory error $oExcel = new PHPExcel();$cacheMe
基本上我试图启用单元格缓存由于内存问题(不断耗尽)其相当大的speadsheet.从我在网上看到的细胞缓存是一个很好的方法
从我在网上找到的例子看起来像这样 Cell caching and memory leak stackoverflow – fix memory error $oExcel = new PHPExcel(); $cacheMethod = PHPExcel_CachedObjectStorageFactory::cache_to_phpTemp; $cacheSettings = array( 'memoryCacheSize' => '512MB'); PHPExcel_Settings::setCacheStorageMethod($cacheMethod,$cacheSettings); 上面的问题是我没有设置excel对象的设置? $oExcel->setCacheStorageMethod($cacheMethod,$cacheSettings); // this returns method not found error 我想我只是初步错了吗? 解决方法
它在开发人员文档的4.2.1节中描述:标题为“Cell Caching”的部分;并且您需要在实例化或加载PHPExcel对象之前设置单元格缓存.
setCacheStorageMethod()不是PHPExcel类的方法,因为您尝试在此行中使用: $oExcel->setCacheStorageMethod($cacheMethod,$cacheSettings); 使用 $cacheMethod = PHPExcel_CachedObjectStorageFactory::cache_to_phpTemp; $cacheSettings = array( 'memoryCacheSize' => '512MB'); PHPExcel_Settings::setCacheStorageMethod($cacheMethod,$cacheSettings); $oExcel = new PHPExcel(); 并且新的PHPExcel对象将自动使用配置的缓存设置(即phptemp) (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |