php过滤excel文件,phpexcel读取excel内存释放怎么处理

php使用phpexcel读取excel的时候,如果excel本身行列较多,很容易引起

Allowed memory size of 134217728 bytes exhausted (tried to allocate 4096 bytes)

内存不够的报错,

于是我写了一段脚本,利用phpexcel过滤器实现块级读取,但是每次读取完毕了,占用的内存不会释放掉,造成多次读取以后还是会报出Allowed memory size of 134217728 bytes exhausted (tried to allocate 4096 bytes)内存不够的错误?

使用unset,=null都没有明显的作用,后面查了下资料,

在PHPExcel_Worksheet和phpexcel类中加了Desroty方法,并且显式调用也没有用

public function Destroy() {

foreach($this->_cellCollection as $index => $dummy) {

$this->_cellCollection[$index] = null;

}

$this->_cellCollection = null;

}

public function Destroy() {

foreach($this->_workSheetCollection as $index => $dummy) {

$this->_workSheetCollection[$index]->Destroy();

$this->_workSheetCollection[$index] = null;

}

$this->_workSheetCollection = null;

}

请问哪位大佬有解决方案啊?

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值